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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Ranking by Region/Product Category/SKU

Hello reposting this as previous solution did not work 😞

 

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:

  • Sales( has SKU,location and Sales)
  • Location(has location with region)
  • Product(which has Product and SKU)

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:

 

EktaMaurya17_0-1697215098650.png

 

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!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1697277455228.png

Jihwan_Kim_1-1697277718255.png

 

 

 

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] )
)

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks a ton! Works perfectly 🙂

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1697277455228.png

Jihwan_Kim_1-1697277718255.png

 

 

 

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] )
)

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.