Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX calculated league table

Hi all

 

I am trying to calculate a table with DAX where locations are ranked based on a deviation from a target (TOTAL DEV) for each month. The first 5 ranks get points every month. It becomes some sort of a game who got the most points. In order to move back and forth in history, what I need is a table that has:

IdMonth
IdSite
SiteLabel
TOTAL DEV
Rank
Points (which will be a calculated column)

All locations would get a rank for each month.

I created a Measure SiteRank:

 

 

SiteRank = CALCULATE(RANKX(ALLSELECTED('Location'[SiteLabel]);[Total Deviation]))

 

 

And the  Score_Table is the calculated table:

 

 

Score_Table = ADDCOLUMNS(
SUMMARIZE('Location';'PowerBI_DCMAdmin ALL_Dim_Location'[IdSite];'Location'[SiteLabel]);"TOTAL DEV";[Total Deviation];"Rank";'Measures'[SiteRank])

 

 

 

The problem I face is that the two tables Location and Date_Day (where I can find IdMonth and is my central date table for the model) have no direct relationship. It all flows through the fact tables (from Location to Fact and from Date to Fact) thus I can't use it in the summarize statement.


I hope I was able to describe the problem sufficiently.
Can anyone help?

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

Instead, you may try using SUMMARIZECOLUMNS.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Awesome, thanks @v-chuncz-msft now the table works! But I created anew problem with it: the ranking does not work.
in the report itself the measure SiteRank works just fine when I select a month to show the score rankings etc. But if i add it to the calculated table using... 

 

Score_Table = SUMMARIZECOLUMNS(DATE_Day'[IdMonth];'Location'[IdSite];'Location'[SiteLabel];"TOTAL DEV";[Total Deviation];"Rank";[SiteRank])

 

 
the rank no longer works, it just shows rank one and rank 58 (the last one):
 29-01-2020 16-00-13.jpg

 

something wrong in my measure?

 

SiteRank = RANKX(ALLSELECTED('Location'[SiteLabel]);[Total Deviation])

 

Thanks again! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.