To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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)
Solved! Go to Solution.
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)
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)
Hi,
Please try something like below whether it suits your expectation.
RankProducts =
RANKX (
ALLSELECTED ( 'Product Lookup'[CategoryName], 'Product Lookup'[ProductName] ),
[Total Orders],
,
DESC,
DENSE
)
Thanks for the suggestion. I tried your solution, but it resulted in an error because CategoryName and ProductName are in two different tables:
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
)
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |