Reputation: 1456
I have table - NBA teams that display their Win% each game.
So the table looks like below
Nov11 Nov12 Nov13
Bulls 43% 50%
Celtics 60% 45%
Suns 55%
So I would like a table in tableau which will display one column, with the latest win%
Win%
Bulls 50%
Celtics 45%
Suns 55%
The latest date each team played is not necessarily the same, so I couldn't use a date filter. I tried some max(date) calculation, but it's not working as I envisioned.
Any advise? thanks. Gemmo
Upvotes: 0
Views: 7529
Reputation: 2275
Is your database structured exactly like that (each month is a column)? If so, you'll need some brute force there, many ELSEIFs until you reach a non-null value, like:
IF NOT ISNULL([Nov 13])
THEN [Nov 13]
ELSEIF NOT ISNULL([Nov 12])
THEN [Nov 12]
ELSEIF NOT ISNULL([Nov 11])
THEN [Nov 11]
...
END
Now if your database is structured in a more convenient way like:
Team Date Win%
Bulls Nov11 43%
Bulls Nov12 50%
Celtics Nov11 60%
...
You can use some table calculations. You should read about it, as it is a very powerful tool. In your case you want:
LOOKUP([Win%],LAST())
And you want this table calculation to partition on Team, ordered by MAX(Date), Ascending. The MAX(Date) is just an aggregation that tableau requires.
This will give the value of last entry of [Win%] per team, ordered by Date, exactly what you want
Upvotes: 1