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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
MichaelaMul
Helper III
Helper III

Rankx Measure with Filter

Hello,

I am trying to adjust a current Ranking Measure to exclude certain Geographies from the Ranking.

 

This is the current measure:

Vol Sales Rank Geo = 
    RANKX (
        FILTER (
            ALLSELECTED('LatestSizes'), 
            NOT ( ISBLANK ( [Vol Sales]  ) )
            ),
        [Vol Sales] ,
        ,
        DESC,
        Dense
    )+0

I tried the following but for some reason it still includes the excluded. As you can see below, now the ranking starts at 3 instead of 1

Vol Sales Rank Geo = 
IF(sum(Geography_Table[New Sort])>12,
    RANKX (
        FILTER (
            ALLSELECTED('LatestSizes'), 
            NOT ( ISBLANK ( [Vol Sales]  ) )
            ),
        [Vol Sales] ,
        ,
        DESC,
        Dense
    )+0,0)

Any Suggestions?

MichaelaMul_0-1742931077574.png

 

Sample data with the desired ranking I want:

GeographyTimeProductVolume SalesNew SortDesired Ranking
Total US - Multi Outlet+Latest 4 Weeks Ending 03-16-25Almond Milk3,047,7541 
Total US - FoodLatest 4 Weeks Ending 03-16-25Almond Milk2,254,6392 
Total US - DrugLatest 4 Weeks Ending 03-16-25Almond Milk16,0043 
Total New England w/ Albany - Multi Outlet+Latest 4 Weeks Ending 03-16-25Almond Milk256,8714 
Total New England w/ Albany - FoodLatest 4 Weeks Ending 03-16-25Almond Milk218,4955 
Total New England w/out Albany - Multi Outlet+Latest 4 Weeks Ending 03-16-25Almond Milk243,0996 
Total New England w/out Albany - FoodLatest 4 Weeks Ending 03-16-25Almond Milk208,6367 
Boston, MA - Multi Outlet+Latest 4 Weeks Ending 03-16-25Almond Milk99,0628 
Boston, MA - FoodLatest 4 Weeks Ending 03-16-25Almond Milk86,2299 
Northern New England - FoodLatest 4 Weeks Ending 03-16-25Almond Milk45,02210 
Northern New England - Multi Outlet+Latest 4 Weeks Ending 03-16-25Almond Milk53,89611 
New York, NY - FoodLatest 4 Weeks Ending 03-16-25Almond Milk221,19412 
Store 1Latest 4 Weeks Ending 03-16-25Almond Milk278,315133
Store 2Latest 4 Weeks Ending 03-16-25Almond Milk82,175146
Store 3Latest 4 Weeks Ending 03-16-25Almond Milk25,4641510
Store 4Latest 4 Weeks Ending 03-16-25Almond Milk255,172164
Store 5Latest 4 Weeks Ending 03-16-25Almond Milk12,2211717
Store 6Latest 4 Weeks Ending 03-16-25Almond Milk60,238187
Store 7Latest 4 Weeks Ending 03-16-25Almond Milk6,9291920
Store 8Latest 4 Weeks Ending 03-16-25Almond Milk10,2932118
Store 9Latest 4 Weeks Ending 03-16-25Almond Milk15,4622214
Store 10Latest 4 Weeks Ending 03-16-25Almond Milk6,9892319
Store 11Latest 4 Weeks Ending 03-16-25Almond Milk30,435249
Store 12Latest 4 Weeks Ending 03-16-25Almond Milk16,8422513
Store 13Latest 4 Weeks Ending 03-16-25Almond Milk304,199261
Store 14Latest 4 Weeks Ending 03-16-25Almond Milk303,098272
Store 15Latest 4 Weeks Ending 03-16-25Almond Milk5,1782821
Store 16Latest 4 Weeks Ending 03-16-25Almond Milk22,1982911
Store 17Latest 4 Weeks Ending 03-16-25Almond Milk4,6483022
Store 18Latest 4 Weeks Ending 03-16-25Almond Milk13,8073116
Store 19Latest 4 Weeks Ending 03-16-25Almond Milk35,465328
Store 20Latest 4 Weeks Ending 03-16-25Almond Milk14,7543315
Store 21Latest 4 Weeks Ending 03-16-25Almond Milk245,274345
Store 22Latest 4 Weeks Ending 03-16-25Almond Milk17,2583512

 

Thank you!

 

7 REPLIES 7
MichaelaMul
Helper III
Helper III

Hi Prashanth, I tried to submit a support ticket but they don't support issues with DAX measures it seems. Do you know if there's a different group to reach out to?

v-prasare
Community Support
Community Support

Hi @MichaelaMulas we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

 

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

Hi! No, both solutions sadly didn't work. As you can see from my reply above. The 1st solution just made all of the rankings be 1 and then the 2nd solution had the same problem I was having, having the ranking start at 3.

Hi @MichaelaMul , 

In this scenario i suggest you to raise a support ticket here. so, that they can assit you in addressing the issue you are facing. please follow below link on how to raise a support ticket:

How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn

 

 

Thanks,

Prashanth Are

 

 

v-prasare
Community Support
Community Support

Hi @MichaelaMul,

Thanks for reaching MS Fabric community support.

 

@Deku, Thanks for your promt response. additionally refer below

 

Vol_Sales_Rank_Geo = 
VAR FilterTable =
    FILTER (
        ALLSELECTED('LatestSizes'),
        NOT ISBLANK ( [Vol Sales] ) &&
        SUM(Geography_Table[New Sort]) > 12
    )
RETURN
    IF(
        SUM(Geography_Table[New Sort]) > 12,
        RANKX (
            FilteredTable,
            [Vol Sales],
            ,
            DESC,
            Dense
        ),
        BLANK() )

 

 

Thanks,

Prashanth Are

Hi!

Thank you both for your reply! I tried both and the first one just made every geography return "1" ranking. Then I tried the second one and I am getting the same problem of it starting the ranking at 3. 

MichaelaMul_0-1742994499511.png

 

Deku
Community Champion
Community Champion

Try iterating over just geography, and I assume vol sales does return blank, not 0

 

Vol Sales Rank Geo =
RANKX (
FILTER (
ALLSELECTED('LatestSizes'[geography]),
NOT ( ISBLANK ( [Vol Sales] ) )
),
[Vol Sales] ,
,
DESC,
Dense
)+0


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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