Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I want to write a dax query, something using Rankx and windows function to get a table that will give me rank for each SKU'sales based on the category and region filters.
I have 3 tables:
linked to each(Sales table linked to Region by location code, Sales linked to Product by SKU and used to calculate the total sales.
I want to calculate the rank of each SKU by Product and Region and display then in ascending order.
Example:
Can anyone help me?
Thanks,
Ekta
@Zubair_Muhammad I saw that you solved a similar problem but it did not work for me. Could you tell me how to go about this one? Would be a great help!
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Total sales: =
SUM( Sales[Sales] )
Rank expected: =
RANK (
SKIP,
SUMMARIZE (
ALL ( Sales ),
Location[Region],
'Product'[Product],
'Product'[SKU]
),
ORDERBY ( [Total sales:], DESC ),
DEFAULT,
PARTITIONBY ( Location[Region] )
)
Thanks a ton! Works perfectly 🙂
Hi,
Please check the below picture and the attached pbix file.
Total sales: =
SUM( Sales[Sales] )
Rank expected: =
RANK (
SKIP,
SUMMARIZE (
ALL ( Sales ),
Location[Region],
'Product'[Product],
'Product'[SKU]
),
ORDERBY ( [Total sales:], DESC ),
DEFAULT,
PARTITIONBY ( Location[Region] )
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 10 | |
| 10 | |
| 6 | |
| 5 |