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
Anonymous
Not applicable

Ranking based on multiple selection of filter

I am trying to build a table, with ranking based on each product's sales, ignoring the sub-category. 

RankingProductProduct Sub-CategorySales
1Health11000
1Health22000
1Health33000
2Living2500
2Living4200
2Living5600
3Dining10100

The DAX expression that I am using : 

RANKX( 

         ALL(Product), 

        CALCULATE(Sales, ALL(Product Sub-Category)),

        ,DESC,

        Dense)

 

However, there's a filter applying to this table, which is Area Code, when I choose more than one area code, for example, two area code, the table will return two rank 1 ( 1 from area A and 1 from area B). 

How can I solve this problem ? Many thanks 

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @Anonymous,

 

Attached PBIX file for reference.

vcgaomsft_0-1653988563467.png

vcgaomsft_1-1653988582137.png

vcgaomsft_2-1653988615278.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

tamerj1
Super User
Super User

Hi @Anonymous 

you can try 

Ranking =
RANKX (
    CALCULATETABLE ( Product, ALLEXCEPT ( Product, Product[Area] ) ),
    CALCULATE ( [Sales], ALL ( Product[Sub-Category] ) ),
    ,
    DESC,
    DENSE
)
Anonymous
Not applicable

Hi @tamerj1 , 

 

Thank you for your suggestion. The ranking are according to their sales now, but one of the issue is that the ranking are not in sequence 1 by 1 

 

Now the table is like this : 

RankingProductProduct Sub-CategorySales
1Health51000
1Health102000
4Living23000
4Living3500
4Living4200
4Living5600
7Dining1100
7Dining3100
7Dining5200
7Dining10300
11Clothes350
11Clothes5100

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.