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
o59393
Post Prodigy
Post Prodigy

Rankx not displaying ranking properly

Hi all

 

I am using a the rankx dax fucntion to rank a colum called ingredient 1 volume.

 

This value leaves within a table called Query1.

 

The dax is:

 

 

 

Rank dax = RANKX(ALL(Query1), [Ingredient 1 volume dax])

 

 

 

When I drag the metric the ranking will look like this:

 

ranking.png

 

As seen the ranking is not displaying properly. So my question is, how can I write the dax in order to isolate the rest of variables?

 

Should I get rid of the ALL function and its reference to the table Query?

 

I just want to rank the ingredient 1 column with whatever filter (year, country for example) I apply.

 

Thanks.

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @o59393 ,

 

We can use the following measure to resolve it.

 

Rank DAX =
RANKX (
    CALCULATETABLE ( DISTINCT ( 'Query1'[Merged] ), ALLSELECTED ( Quey1 ) ),
    CALCULATE ( [Ingredient 1 volume dax] ),
    ,
    DESC,
    DENSE
)

 

If it doesn't work, could you please show formula of [Ingredient 1 volume dax] if it does not contain any confidential information?


Best regards,

 

Community Support Team _ Dong Li
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

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @o59393 ,

 

We can use the following measure to resolve it.

 

Rank DAX =
RANKX (
    CALCULATETABLE ( DISTINCT ( 'Query1'[Merged] ), ALLSELECTED ( Quey1 ) ),
    CALCULATE ( [Ingredient 1 volume dax] ),
    ,
    DESC,
    DENSE
)

 

If it doesn't work, could you please show formula of [Ingredient 1 volume dax] if it does not contain any confidential information?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Can I add a filter condition to this   measure? 

Thanks for the help @v-lid-msft and @Anonymous  it's perfect:

 

rank111.PNG

Regards.

 

Anonymous
Not applicable

Hi @o59393 ,

 

1. Is your [Ingredient 1 volume dax] a measure? If yes, could you please show it?

2. Could you please show me your data model?

 

Because I tried it on my desktop, it works.

 

Thanks.

Aiolos Zhao

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