Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I have a data set of game logs for a basketball season. I want to do a ranking for a statistic comparing all teams, but only up to the current date of that specific row. Since not every team plays every day, the current row should be the max date and it should rank based on the most recent value up to that date. I have a measure that does the correct calculation:
LatestTmDVP =
VAR thisdate =
MAX ( [DATE] )
VAR maxdate =
CALCULATE ( MAX ( [DATE] ), ALLSELECTED ( 'NBA-PLAYER-FEED'[DATE] ) )
VAR result =
CALCULATE (
MAX ( 'NBA-PLAYER-FEED'[TmDVPoToDt] ),
'NBA-PLAYER-FEED'[DATE] = maxdate
)
RETURN
IF ( thisdate = maxdate, result )
If I put this in a report with a date slicer, I can see that it is working correctly:
So I need to get this measure into a column, with the max date set as the date of the current row, and then do a rank of teams based on that, but I just can't get the RankX syntax right for this. Appreciate any help!
Solved! Go to Solution.
So I ended up just giving up on this. I'm nearly certain it could be done in a formula for a column, but I ended up just creating a new sheet that has every date and team, regardless if they play or not, and looks up the current day's value, and if there is none, the prior day's value, etc. etc. So I then have a table with the most recent values. Essentially it's just brute-forcing what surely could be more elegant, but it works
So I ended up just giving up on this. I'm nearly certain it could be done in a formula for a column, but I ended up just creating a new sheet that has every date and team, regardless if they play or not, and looks up the current day's value, and if there is none, the prior day's value, etc. etc. So I then have a table with the most recent values. Essentially it's just brute-forcing what surely could be more elegant, but it works
So I need to get this measure into a column
That is not something you can do in Power BI. Rethink your requirement, maybe you can achieve it with a different approach.
Thanks for the reply. I might have to go back to Excel if I can't do it in PowerBI. Could I use a function like CalculateTable that would do similar to what the report with the slicer does, allowing it to essentially do a rank based on the most recent value? Or what about creating some kind of table with every date and every team that would allow a lookup?
User | Count |
---|---|
120 | |
69 | |
68 | |
57 | |
50 |
User | Count |
---|---|
166 | |
82 | |
68 | |
65 | |
54 |