3 Replies Latest reply on Oct 20, 2016 7:43 AM by Matt Fischer

# Develop soccer standings dashboard

I have the following datasource:

 GameID Team Name Goals 1 Villareal 5 1 Celta 0 2 Sporting 1 2 Valencia 2 3 Barcelona 4 3 Deportivo 0 4 Villareal 1 4 Sporting 3 5 Barcelona 4 5 Valencia 2 6 Deportivo 2 6 Celta 1

I want to have a statistics dashboard like this:

 Team Name MP W D L GF GA Dif Barcelona 2 2 0 0 8 2 6 Villareal 2 1 0 1 6 3 3 Sporting 2 1 0 1 4 3 1 Valencia 2 1 0 1 4 5 -1 Deportivo 2 1 0 1 2 5 -3 Celta 2 0 0 2 1 7 -6

Each column will be calculated field. I know the logic but I don'tt know how to implement it in Tableau.

W (Wins):

For each [Team Name] COUNT([MatchID]) IF( [Goals] (for team A) > [Goals] (for team B)) (Addressing for MatchID)

L (Losses):

For each [Team Name] COUNT([MatchID]) IF ( [Goals] (for team A) < [Goals] (for team B)).(Addressing for MatchID)

D (Draws):

For each [Team Name] COUNT([MatchID]) IF ( [Goals] (for team A) = [Goals] (for team B)).(Addressing for MatchID)

MP (Match played):

For each [Team Name] SUM (W, D, L)

GF (Goals Favor):

For each [Team Name], SUM ([Goals]) IF( [Goals] (Team Name) > [Goals] (Opponet Team)) (Addressing for MatchID)

GF (Goals Against):

For each [Team Name], SUM ([Goals]) IF( [Goals] (Team Name) < [Goals] (Opponet Team)) (Addressing for MatchID)

Thanks for your collaboration

• ###### 1. Re: Develop soccer standings dashboard

I'm taking a stab on this. For Goals Favor, the equation would be
{Fixed [Gameid], [Team Name]: sum([Goals])}

Continuing on the rest.

• ###### 2. Re: Develop soccer standings dashboard

Hello dear Tableau people;

I finally figured it out (thanks to MATT FISCHER, who share some clues).

The calculated fields that developed are:

• aux_goals: {FIXED  [Game ID], [Team Name]:SUM([Goals])}
• aux_goals_max: {FIXED  [Game ID]: MAX([aux_goals])}
• aux_goals_min: {FIXED  [Game ID]: MIN([aux_goals])}
• GF: IF [aux_goals] = [aux_goals_max] THEN [aux_goals_max] ELSE [aux_goals_min] END
• GA: IF [aux_goals] = [aux_goals_max] THEN [aux_goals_min] ELSE [aux_goals_max] END
• DIF: [GF]-[GA]
• W: IF [GF] > [GA]  THEN 1 ELSE 0 END
• L: IF [GF] < [GA] THEN 1 ELSE 0 END
• D: IF [GF] = [GA] THEN 1 ELSE 0 END
• MP: [W] + [L] + [D]

All of them were aggregated as SUM

Please find attached the workbook with the solution.

I am sharing it to those who wants to design a similar viz.

Please rate it! or mark it as a correct solution!

Best Regards.

Alejandro.

2 of 2 people found this helpful
• ###### 3. Re: Develop soccer standings dashboard

I'm so glad you figured it out, this was bothering me last night. I'll probably be using this in some sports dashboards as well, thanks Alejandro!