Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello exports,
Here I want the the 5 countries by percantage, but when I did that, it give percet of each country of thr gradn total of this top 5 as you see in right table.
But What I want is to give the 5 countries of grand total for all countries as you see in left table, but I want the top 5 only. What the DAX code to do that?
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Value country: =
SUM( Data[Value] )
Value percent grandtotal: =
VAR _valueall =
CALCULATE ( [Value country:], ALL () )
RETURN
DIVIDE ( [Value country:], _valueall )
Top five percent: =
CALCULATE (
[Value percent grandtotal:],
KEEPFILTERS (
TOPN (
5,
ADDCOLUMNS (
ALL ( Data[Country] ),
"@valuepercent", [Value percent grandtotal:]
),
[@valuepercent], DESC
)
)
)
Hi,
Please check the below picture and the attached pbix file.
Value country: =
SUM( Data[Value] )
Value percent grandtotal: =
VAR _valueall =
CALCULATE ( [Value country:], ALL () )
RETURN
DIVIDE ( [Value country:], _valueall )
Top five percent: =
CALCULATE (
[Value percent grandtotal:],
KEEPFILTERS (
TOPN (
5,
ADDCOLUMNS (
ALL ( Data[Country] ),
"@valuepercent", [Value percent grandtotal:]
),
[@valuepercent], DESC
)
)
)
Good Work Mr. Jihwan.
but I am not understad the line I highlited. How I can made in my measure>>
@Anonymous
This is a name given to a virtual column created by ADDCOLUMNS therefore just type it as is
Hi,
Sorry that I quite do not understand your question.
You can check my attached file, or, please share your sample pbix file's link here, and then I can try to look into it to provide a more accurate solution for your data model.
Thanks.
Hello Sir, sorry my data is confidital.
My quesion is what are ( "@valuepercent" and [@valuepercent]) meaning??
my measure is same for you, but I dont know what I mentioned before meaning and how I write in my measure?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |