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

summarize monthly ranking per category

Hello, i was having some difficulties to get the DAX formula for monthly rank.

i would like to summarize my table that shows only the top rank per each month with respect to region category as shown below table.

anyone could assist me to achieve this. Thanks.

 

MonthRegionCost Rank
​​​​​​​​​​​JanCR2153098  
​​​​​​​​​​​JanER1832120  
​​​​​​​​​​​JanWR1419893  
​​​​​​​​​​FebCR2093887  
​​​​​​​​​​FebER1254795  
​​​​​​​​​​FebWR2932801  
​​​​​​​​​MarCR3843352  
​​​​​​​​​MarER2167873  
​​​​​​​​​MarWR4185748  
​​​​​​​​AprCR5245395  
​​​​​​​​AprER3301028  
​​​​​​​​AprWR7426182  

 

 

The result table, that i could put graph

 

MonthRegionCost Rank
​​​​​​​​​​​JanCR2153098 1
​​​​​​​​​​FebWR2932801 1
​​​​​​​​​MarWR4185748 1
​​​​​​​​AprWR7426182 1
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below

Rank = 
VAR _selmonth =
    SELECTEDVALUE ( 'Table'[Month] )
RETURN
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month] = _selmonth ),
        CALCULATE ( SUM ( 'Table'[Cost] ) ),
        ,
        DESC,
        DENSE
    )

2. Create a table visual and apply a visual-level filter with the condition (Rank is 1)

vyiruanmsft_0-1696495385474.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below

Rank = 
VAR _selmonth =
    SELECTEDVALUE ( 'Table'[Month] )
RETURN
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month] = _selmonth ),
        CALCULATE ( SUM ( 'Table'[Cost] ) ),
        ,
        DESC,
        DENSE
    )

2. Create a table visual and apply a visual-level filter with the condition (Rank is 1)

vyiruanmsft_0-1696495385474.png

Best Regards

Mageto
New Member

Create a calculated column and use 'RANKX' with a filter using the earlier function ie 'table'[month]=earlier('table'[month]). This ensure cost ranking is grouped by month. Here's a rough sketch:

Rank =
RANKX(
    FILTER(
        'Rank',
        'rank'[Month] = EARLIER('rank'[Month])
    ),
    'rank'[Cost],
    ,
    DESC,
    Dense
)
Upto this point, you can use the cost column in a graph and add a chart level filter that only filters where your new rank column = 1. It will work perfectly.
If you need a table with only top ranks like you had shown above, you can create a new table that filters out where the rank column = 1. Here's how:
Top_Rank_Table = FILTER('Rank','Rank'[Rank]=1).
I hope this helps!
Anonymous
Not applicable

i have an error using the EARLIER Formula, show parameter is not correct.

 

My month column is from a calculated column

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (3,469)