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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
DimD
Frequent Visitor

Rankx with duplicate rows

Hello dear community,

I have a problem with the ranking.
I have a table with duplicate data,
People who have made interventions per day.
I try to have a ranking to be able to make other measurements.
I tried the expression rankx, as well as other articles from here including this one which I thought would help me but as you see it is not the case.

DimD_0-1659896290085.png

 


I should have seen the closest date to 01/01/2022 in number 1 and not 16...

You will find a sample of data below.

Can you help me?

Thanks

Sample+sources  

1 ACCEPTED SOLUTION
DimD
Frequent Visitor

I found the solution based on the article :

Power BI – Handling Duplicate Rankings Using the R... - Microsoft Power BI Community
First of all, I had too many duplicates that were polluting the results.
So I took the table and made a reference.
Then I removed the nulls that were creating a lot of duplicates, I applied the filters for the ranking directly on the table.
Then I created an index

After that I created a column :

Rank = rankx(Filter(table,myfield = Earlie(myfield)), date, , ASC, Dense)
Rank corrected = rankx(Filter(table,myfield = Earlier(myfield)),myfield + index/power(10,5)), ,ASC, Dense

DimD_0-1660318320887.png

 

View solution in original post

2 REPLIES 2
DimD
Frequent Visitor

Hello, 

Little update. 

Here is the expected result : 

DimD_0-1659942485764.png

I try a new link but its not working : Power BI – Handling Duplicate Rankings using RANKX DAX Function | LinkedIn

and this one : Solved: Rankx = struggling with duplicates values - Microsoft Power BI Community

Perhaps I make a mistake... 

DimD
Frequent Visitor

I found the solution based on the article :

Power BI – Handling Duplicate Rankings Using the R... - Microsoft Power BI Community
First of all, I had too many duplicates that were polluting the results.
So I took the table and made a reference.
Then I removed the nulls that were creating a lot of duplicates, I applied the filters for the ranking directly on the table.
Then I created an index

After that I created a column :

Rank = rankx(Filter(table,myfield = Earlie(myfield)), date, , ASC, Dense)
Rank corrected = rankx(Filter(table,myfield = Earlier(myfield)),myfield + index/power(10,5)), ,ASC, Dense

DimD_0-1660318320887.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.