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
Anonymous
Not applicable

Sum of Top3 Values

Imagine we have a similar dataset: 

I would like to create a measure using DAX that shows the total revenue for Top 3 countries only, from all companies of course!

 

I would like to know whether is is possible to do it in one formula. So far I did it in a couple of steps, but the question is whether a formula is possible to create that automatically figures out top 3 countries and then displays the sum of all revenues from these.

 

Your help will be much appreciated

CountryRevenueCompany
DE500 A
US400 A
GB300 A
FR200 A
ES100 A
US620 B
GB420 B
ES520 B
LV120 B
FR320 B
DE570 C
GB680 C
US215 C
ES350 C
FR485 C
1 ACCEPTED SOLUTION
v-caliao-msft
Microsoft Employee
Microsoft Employee

@Anonymous,

 

Create a rank column in your data model, and then add this rank column to your visual filter.

Rank = RANKX(FILTER(Sales,Sales[Company]=EARLIER(Sales[Company])),Sales[Revenue],,DESC)

Capture.PNG

 

Regards,

Charlie Liao

 

View solution in original post

1 REPLY 1
v-caliao-msft
Microsoft Employee
Microsoft Employee

@Anonymous,

 

Create a rank column in your data model, and then add this rank column to your visual filter.

Rank = RANKX(FILTER(Sales,Sales[Company]=EARLIER(Sales[Company])),Sales[Revenue],,DESC)

Capture.PNG

 

Regards,

Charlie Liao

 

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.