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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
_chris_
Helper III
Helper III

RANKX Measure always 1

Hi,

 

this question probably was asked many times  but still I do not get it:

 

There is a table having ~200.000 lines.

 

Relevant columns are Date, Customer, Revenue (=Umsatz) etc.

 

Now I want to create a Rank measure:

 

SumUmsatz := CALCULATE(SUM(vbasFASTEC_WaWiVKBelegpositionen[Umsatz]))
Rank Test := RANKX(vbasFASTEC_WaWiVKBelegpositionen, [SumUmsatz])
 

Now my table gives me the following result:

 

2020-07-18 12_33_57-GF - Power BI Desktop.png

 

Actually I expected to get the yearly rank of Umsatz.

 

What am I doing wrong?

 

Thx Christian 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@_chris_ 
There are some differences of using RANKX() in a calculated column and a measure.

 

Calculated Column:

 

Column = RANKX('vbasFASTEC_WaWiVKBelegpositionen',[Umsatz],,DESC,Dense)

 

Measure:

 

Measure = RANKX(ALL('vbasFASTEC_WaWiVKBelegpositionen'),CALCULATE(SUM([Umsatz])),,DESC,Dense)

 

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
lbendlin
Super User
Super User

Examine your filter context and adjust as needed with a modifier.

This was a very quick response. Thx for this.

 

However, I do not understand what you mean? I need to adjust the measure itself or in the visual?

The measure. Throw in an ALL() somewhere.

 

Read up on row context and filter context. It will be confusing at first but it is fundamental to enjoying DAX in the long run.

That´s what I also had tried before:

 

RANKX(ALL(vbasFASTEC_WaWiVKBelegpositionen), [SumUmsatz])

 

But I still get the same result.

 

Yesterday I looked some videos about DAX theory as I agree it is important to understand the basics. Actually, I was of the opinion to have understood it... 

 

Even if I add the Id column to the table (the data is not aggregated anymore) the rank is always 1...

Anonymous
Not applicable

@_chris_ 
There are some differences of using RANKX() in a calculated column and a measure.

 

Calculated Column:

 

Column = RANKX('vbasFASTEC_WaWiVKBelegpositionen',[Umsatz],,DESC,Dense)

 

Measure:

 

Measure = RANKX(ALL('vbasFASTEC_WaWiVKBelegpositionen'),CALCULATE(SUM([Umsatz])),,DESC,Dense)

 

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

SumUmsatz := sum(vbasFASTEC_WaWiVKBelegpositionen[Umsatz]) 

Rank Test := RANKX(all(vbasFASTEC_WaWiVKBelegpositionen), [SumUmsatz])

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.