Hi,
I’ve got 2 issues about RANKX which need some help from the expert here.
No1 is I’m facing a same Ranking while actually my data displayed 2 different value.
My measure is like this :
My intention on that measure is I want to rank my products but only products which categorized in my Product table as category “A”
But that measure result a same rank for 2 of my rows like below:
The column “item id” here is my field inside Product table.
No.2 is I also want to rank my Products (with the same category = “A”) but also filtering my transactions in which in my transactions has a special category, lets say because it is Sales Transaction, I have field SalesPool. I want to filter the sales transactions into only those with SalesPool=“West”. Question is can I just add the criteria inside the CALCULATE function ?
There are a number of different routes you could take here, but this is the approach I would use:
For your products, filter that table based using the filter pane, and for your Sales Pool, create a measure that calculates total quantity filtered by the transaction type you want.
I’ve created a parallel example using the Practice Dataset External tool. Here’s how it looks all put together:
Thanks, it works!
But for my learning purposes, what’s wrong actually with my previous measures ? Seems not much different than yours, except for the ALLSELECTED which is to response the slicers. And if not mistaken, the HASONEVALUE is for cater the Grand Total to not having ranking as well, right ?
Yes, you were quite close to the solution on this one. The changes made were:
ALL to ALLSELECTED
Addition of HASONEVALUE to avoid ranking on the total row
Total Sales as a measure to avoid the need for the CALCULATE context transition
The selection of the products to be included via Filter Pane, rather than DAX code. There are pros and cons of each approach, so the ultimate choice in this one will depend on your specific requirement