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
glsera
New Member

RAnkX formula giving different values the same rank

Hi everyone,

 

I need help with a DAX formula. 

 

For some reason, my ranking doesn't seem to work. I need to create a rank without repeated values, I'm currently using the following formula:

RankCOPQ = RANKX(ALLSELECTED('Table');CALCULATE(SUM(('Table'[Amount $])));;DESC;Dense)

But, for some reasons, different values have the same rank, as you can see in the pic below:

PBi.png

How can I solve this out? I've been trying to find fixes everywhere but I wasn't able to find someone that had the same problem that I have.

 

Thank you very much!

 

 

 

 

3 REPLIES 3
Anonymous
Not applicable

RankCOPQ =
	RANKX(
		ALLSELECTED('Table'[Amount $]);
		CALCULATE(MAX('Table'[Amount $]))
		; ; DESC;
		Dense
	)

If you drop the "Amount $" column on a visual, only the distinct values from the column are displayed. If you use SUM(...) all the rows with the same value of "Amount $" will be summed up. This is not what you want. You want the value itself, hence MAX(...), which will return the value itself.

 

Best

Darek

Hi Darek,

 

Thank you very much. I appreciate the effort in helping me.

 

Thankfuly, the rank problem is solved, the thing is, the rank doesnt seem to work correctly, e.g.

pbi2.png

 

The rank 4 should be the number one, since it represents the biggest value in amount $, so, what I'm doing wrong?

 

I'm deeply sorry for the lack of knowledge, i'm a total beginner in DAX. 

Anonymous
Not applicable

You are simply not describing the problem correctly 🙂 My measure works correctly based on the assumptions I've made. But they are not what is true, hence the results.

 

You have to show the full report, not only the two columns as I suspect this is not what's in the visual. You don't rank the amounts themselves but something different. The amounts are most likely calculated for this "something different."

 

Please post the full story.

 

Best

Darek

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.