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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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