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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
growandgrow
Frequent Visitor

RANKX missing a number in ranking due to zeros or lines that shouldn't be considered in formula

Hi all,

 

I am having an issue in Power BI destkop using the RANKX formula - my formula is below:

 

GURA Rank District = RANKX( ALL('VW_STORE'[District]), [RT GURA %] , , DESC, Dense )

 

I have a variance expression that takes positive and negative values, and blank expressions will be ranked the same as zero. A tell-tale sign that this has happened is that the "missing" rank occurs between a positive and negative value.

 

As you can see in the picture below, it appears as if the ranking of '4' has been calculated by values I do not want to be included in my ranking.

growandgrow_0-1656087806004.png

I have tried to modify my formula in a variety of different ways to eliminate the missing ranking of 4 but have been unsuccessful. If this is the formula I am using, do you have any ideas on how I could modify it to make it rank correctly using only the numbers that should be considered in the expression (and not zeros?)

 

Thanks so much.

kc

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

Hi @growandgrow ,

According to your description, I create a sample. Here's my solution.

Modify the formula like this:

Rank =
RANKX (
    FILTER ( ALL ( 'VW_STORE' ), 'VW_STORE'[RT GURA %] <> BLANK () ),
    [RT GURA %],
    ,
    DESC,
    DENSE
)

For the row with blank value, it can still get a rank value, but the rank of other rows will keep continuous.

vkalyjmsft_1-1656405199330.png

vkalyjmsft_2-1656405389265.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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-yanjiang-msft
Community Support
Community Support

Hi @growandgrow ,

According to your description, I create a sample. Here's my solution.

Modify the formula like this:

Rank =
RANKX (
    FILTER ( ALL ( 'VW_STORE' ), 'VW_STORE'[RT GURA %] <> BLANK () ),
    [RT GURA %],
    ,
    DESC,
    DENSE
)

For the row with blank value, it can still get a rank value, but the rank of other rows will keep continuous.

vkalyjmsft_1-1656405199330.png

vkalyjmsft_2-1656405389265.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

I am also in the same situation where I need my rankx not to rank blank columns. 

hemsun_0-1694133313112.png

I used the below measure. How to resolve the empty space showing rank 3 

rank = rankx(
    filter(all('rank table'), [Petrol Vehicles Growth measure] <> BLANK()),
[Petrol Vehicles Growth measure],, DESC)

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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