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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
insandur
Helper II
Helper II

Repeating Rank values in the RANX dax

Hi, 

i am using RANKX measure to create rank index to my [devitaion in pcs] measure which is using two tables to calculated dviation. Froma Actuals & Forecast table . this is the measure i am using

RANKX(ALLSELECTED(Actuals[Ex Works Date],Actuals[Location Desc],Actuals[Ship-To Location Desc],Actuals[LGC ID],Actuals[LGC Description],Actuals[Qty]),[LAG 1 FC Deviation in Pcs],,DESC).   But i get repeating rank values except for 1st rank value.

Actual monthSupplier locationShip-To LocationLGCPurchase FCActualsDeviation in PcsFC Acuuracy in %Root causeContra actionsRank
8/1/2024ac1ab12312040127120115080-856%NANA1
8/1/2024ac1ab231428809886555985-31%NANA2
7/1/2024ab1ab56305406054060NANANA2
7/1/2024ab1ab76505355553555NANANA2
9/1/2024aa1abg54577601071304937015%NANA2
7/1/2024ab1ab23104525045250NANANA2




How do i get unique rank values to my table.

 

5 REPLIES 5
v-zhouwen-msft
Community Support
Community Support

Hi @insandur ,

Is it possible to provide .pbix files without sensitive data? It looks like your '[LAG 1 FC Deviation in Pcs]' returned a duplicate value, so the subsequent rank returned is 2.

 

Best Regards,
Wenbin Zhou

Kedar_Pande
Super User
Super User

@insandur 

When you use the RANKX function in DAX to create a ranking measure, repeating rank values can occur when there are ties in the values being ranked. In your case, it seems that the [LAG 1 FC Deviation in Pcs] measure is resulting in equal values for multiple rows, which leads to the same rank being assigned.

To address the issue of repeating ranks, you can modify your RANKX measure to use a tiebreaker. A common approach is to add a secondary column to the ranking criteria that ensures uniqueness among the tied items.

saud968
Super User
Super User

Try this

Rank =
RANKX(
ALLSELECTED(
Actuals[Ex Works Date],
Actuals[Location Desc],
Actuals[Ship-To Location Desc],
Actuals[LGC ID],
Actuals[LGC Description],
Actuals[Qty]
),
[LAG 1 FC Deviation in Pcs] +
DIVIDE(
Actuals[Qty],
MAXX(ALLSELECTED(Actuals), Actuals[Qty]),
0
),
,
DESC
)

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!


Thank You Saud,

 

I tried above method, i get below error on this.

insandur_0-1728918820039.png

 

bhanu_gautam
Super User
Super User

@insandur , Try using  DAX
RANKX(
ALLSELECTED(
Actuals[Ex Works Date],
Actuals[Location Desc],
Actuals[Ship-To Location Desc],
Actuals[LGC ID],
Actuals[LGC Description],
Actuals[Qty]
),
[LAG 1 FC Deviation in Pcs] + Actuals[UniqueID] * 1e-10,
,
DESC
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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