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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SQLDev
Regular Visitor

Clarification Needed: How Filters Work

As someone who is new to Power BI and just starting to learn, I'm trying to rank products based on their orders. However, I'm encountering an issue where the ranking does not update correctly when I apply a page-level filter on CategoryName. Below is the DAX formula I'm using. Could you please help me identify if I'm missing something?

Total Orders = DISTINCTCOUNT('Sales Data'[OrderNumber])
RankProducts = RANKX(ALLSELECTED('Product Lookup'),
 [Total Orders],
 ,DESC,Dense) 

 

 

Udemy2.png

1 ACCEPTED SOLUTION
SQLDev
Regular Visitor

Initially, the DAX expression wasn't working because I created a calculated column instead of a measure. Once I used the same formula as a measure, it worked perfectly.

RankProducts = RANKX(ALLSELECTED('Product Lookup'),
 [Total Orders],
 ,DESC,Dense)

 

View solution in original post

4 REPLIES 4
SQLDev
Regular Visitor

Initially, the DAX expression wasn't working because I created a calculated column instead of a measure. Once I used the same formula as a measure, it worked perfectly.

RankProducts = RANKX(ALLSELECTED('Product Lookup'),
 [Total Orders],
 ,DESC,Dense)

 

Jihwan_Kim
Super User
Super User

Hi,

Please try something like below whether it suits your expectation.

 

 

RankProducts =
RANKX (
    ALLSELECTED ( 'Product Lookup'[CategoryName], 'Product Lookup'[ProductName] ),
    [Total Orders],
    ,
    DESC,
    DENSE
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks for the suggestion. I tried your solution, but it resulted in an error because CategoryName and ProductName are in two different tables:

  • 'Product Categories Lookup'[CategoryName]
  • 'Product Lookup'[ProductName]

 

 

I am not sure how your semantic model looks like, but please try something like below.

 

RankProducts =
RANKX (
    ALLSELECTED ( 'Product Lookup'[ProductName] ),
    [Total Orders],
    ,
    DESC,
    DENSE
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.