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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rampsaladi
Frequent Visitor

Dynamically Calculating Rank based on Slicer

I have the following sample Dataset and I need to be able to rank the SKU based on the $ Amount for a specific time period and product combination. The user wants to see ranks for multiple time periods but these need to change based on Product selection as a slicer. Below is the data. Any help would be appreciated

 

Time PeriodProductsSKU$ Amount
Last 4 WeeksAAA1
Last 4 WeeksAAB3
Last 4 WeeksAAC0.5
Last 4 WeeksBBA2
Last 4 WeeksBBB1
Last 4 WeeksBBC6
Last 16 WeeksAAA3
Last 16 WeeksAAB4
Last 16 WeeksAAC1
Last 16 WeeksBBA4
Last 16 WeeksBBB6
Last 16 WeeksBBC7
1 ACCEPTED SOLUTION

@rampsaladi

 

Rank =
RANKX (
    ALLSELECTED ( TableName ),
    CALCULATE ( SUM ( TableName[$ Amount] ) ),
    ,
    DESC,
    DENSE
)

View solution in original post

3 REPLIES 3
Rfranca
Resolver IV
Resolver IV

 

hi, @rampsaladi

rankn = RANKX(ALL(tabela[Time Period];tabela[Products];tabela[SKU]);[TT_Amount];;ASC;Dense)

@rampsaladi

 

Rank =
RANKX (
    ALLSELECTED ( TableName ),
    CALCULATE ( SUM ( TableName[$ Amount] ) ),
    ,
    DESC,
    DENSE
)

Thank you this helps

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors