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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SajnaM
New Member

How to use Rankx for top 5 column (country) on monthly basis

I'm creating a Power Bi report.

I have a table which give list of applicable countries on monthly basis. I like to get top 5 countries of each month to show the monthly trend of top 5 items.

Below is the data sample - I need a rank number on countries - which is top 5 countries of feb and top 5 for mar. Can you please help me to make this?

Going forward, we will get monthly data similar to this. so, every month, we should get this. Not sure how to group date and country and get the rank for each month.

 

SajnaM_1-1617026558134.png

 

 

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @SajnaM ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-lionel-msft
Community Support
Community Support

Hi @SajnaM ,

 

Try to create such a measure.

 

Rank = 
RANKX(
    FILTER(
        ALL(Sheet4),
        [Date].[Year] = MAX([Date].[Year]) && [Date].[MonthNo] = MAX([Date].[MonthNo]) 
    ),
    CALCULATE(SUM(Sheet4[Values])), , DESC, Dense
)

 

v-lionel-msft_0-1617156175367.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.