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
m_e_1203
Helper II
Helper II

RANKX

Hello,

 

I am trying to creating ranking, somehow, DAX below provides this ranking below.

 

Original Table (WorkHour) contains [ITEM_LINE] daily per [BID_Assembler]. And I would like to calculate YTD ranking by total of [ITEM_LINE].

 

DateKeyBID_AssemblerITEM_LINE
4/1/2019 A394
4/1/2019 B331
4/1/2019 C383
4/1/2019 D325
4/1/2019 E116
4/1/2019 F312
4/1/2019 G243
4/1/2019 H5

 

Total Pick Line = SUM( WorkHour[ITEM_LINE])
Rank Total Pick Line = RANKX(ALLSELECTED(WorkHour), CALCULATE([Total Pick Line], ALLEXCEPT(WorkHour, WorkHour[BID_Assembler])) , , DESC)
 
BID_AssemblerITEM_LINETotal Pick LineRank Total Pick Line
A       190,560           190,560                                 1
B       188,828           188,828                             471
C       155,889           155,889                             940
D       154,284           154,284                         1,400
E       148,067           148,067                         1,847
F       146,787           146,787                         2,092
G       140,904           140,904                         2,490
H       137,873           137,873                         2,842
I       137,746           137,746                         3,296
J       134,799           134,799                         3,763
K       134,426           134,426                         4,203
 

Why this does not show correct ranking?

 

Thank you.

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@m_e_1203 , You have to create a rank like

 

Rank Total Pick Line = RANKX(ALLSELECTED(WorkHour[BID_Assembler]), [Total Pick Line] , , DESC)

 

 

if you need ytd create a ytd measure have rank on that

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@m_e_1203 , You have to create a rank like

 

Rank Total Pick Line = RANKX(ALLSELECTED(WorkHour[BID_Assembler]), [Total Pick Line] , , DESC)

 

 

if you need ytd create a ytd measure have rank on that

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

Thank you so much!! Worked!!

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.