The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Country | Revenue | Company |
DE | 500 | A |
US | 400 | A |
GB | 300 | A |
FR | 200 | A |
ES | 100 | A |
US | 620 | B |
GB | 420 | B |
ES | 520 | B |
LV | 120 | B |
FR | 320 | B |
DE | 570 | C |
GB | 680 | C |
US | 215 | C |
ES | 350 | C |
FR | 485 | C |
Solved! Go to Solution.
@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)
Regards,
Charlie Liao
@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)
Regards,
Charlie Liao
User | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |