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
nleuck_101
Responsive Resident
Responsive Resident

Calculate Top 10 total

Hello All,

 

I'm trying to calculate the top 10 total count for another measure where I see what percentage the top 10 account for the total count. Below I will list out my measures. Any help would be greatly appreciated.

 

Total Count = COUNT(Table[Id])
Total Subtopic Rank = RANKX(ALLSELECTED(Table[Subtopic]), [Total Count],,DESC)
Top 10 Subtopics Count = CALCULATE([Total Count], FILTER(Table, [Total Subtopic Rank] <= 10))


My measure [Top 10 Subtopics Count] total is 10,453. This is incorrect, that's the total of all my subtopics. I would have expected it to be 3,825, which is the total count of my top 10 subtopics. What am I doing wrong?

1 ACCEPTED SOLUTION
nleuck_101
Responsive Resident
Responsive Resident

Well, I was able to solve it. I created a variable for my top 10 first.

VAR _Top10 = TOPN(10, ALL(Table[Subtopic]), [Total Count], DESC) RETURN CALCULATE([Total Action Item], FILTER(Table, Table[Subtopic] IN _Top10))

Then I divide that measure with my total count to get the percentage I was expecting.

View solution in original post

2 REPLIES 2
ajaybabuinturi
Memorable Member
Memorable Member

Hi @nleuck_101,
Could you change your measures as below, I hope you will get the required result.

Total Count = COUNT(Table[Id])
Top 10 Subtopics Count = 
SUMX( TOPN(10, VALUES(Table[Subtopic]), [Total Count], DESC), CALCULATE([Total Count]))

 

Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

nleuck_101
Responsive Resident
Responsive Resident

Well, I was able to solve it. I created a variable for my top 10 first.

VAR _Top10 = TOPN(10, ALL(Table[Subtopic]), [Total Count], DESC) RETURN CALCULATE([Total Action Item], FILTER(Table, Table[Subtopic] IN _Top10))

Then I divide that measure with my total count to get the percentage I was expecting.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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 (896)