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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
raphazzz
Helper I
Helper I

How to create a measure that shows % filtered by TOP 10 from the Total?

Hello friends,


I have a spreadsheet that has the total number of cancellations as 293 and I have a table that has the top 10 cities with cancelations and the total of the top 10 is 257. I need to create a card that shows 87%.

The table has a TOPN filter. I tried to create a measure with two variables, one counting the total number of rows (293) and another variable with the topN of the same count (like the table).  

It didn't work. Can you guys help me?

raphazzz_1-1675903320411.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@raphazzz , Assuming cancels is not a TOPN measure create topn meausre

 

M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels])

 

M1 % = divide(M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels]), calculate([Cancels], allselected()) )

 

or

 

M1 % = divide(M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels]), calculate([Cancels], all()) )

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@raphazzz , Assuming cancels is not a TOPN measure create topn meausre

 

M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels])

 

M1 % = divide(M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels]), calculate([Cancels], allselected()) )

 

or

 

M1 % = divide(M1= SUMX(keepfilters(topn(10, ALL('Table'[Customer City]) , [Cancels], desc)), [Cancels]), calculate([Cancels], all()) )

Thanks for your help! I tweaked the second formula a little bit and it's working.

raphazzz_0-1675911042523.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.