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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
Anonymous
Not applicable

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors