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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Get the % of the filtered value and total

I'm trying to create a new visual that will get the percentage of the filtered value vs total.

Format:

 

Name: (Slicer)

 

Value: Total value (Var ABC; Sum of column) | Selected Value (Var ABC) | %Percentage

 

Example 1

 

Name: Name1

 

Value: 100,000,000 | 1,000,000 | 1%

 

Example 2

 

Name: Name2

 

Value: 100,000,000 | 2,000,000 | 2%

 

Example 3

 

Name: All

 

Value: 100,000,000 | 100,000,000 | 10

 

Any ideas on what's the best approach to achieve my goal.

UPDATE:

Here's what I created so far

 

Total =
var ABC = '_sp-Total Invoiced to Date - Current Month'[Total Invoiced Current] - [Current Cost & Expense]
 
RETURN divide((CALCULATE(SUMX('_sp-Total Invoiced to Date - Current Month',ABC), ALLSELECTED('_sp-Total Invoiced to Date - Current Month'))),(CALCULATE(SUMX('_sp-Total Invoiced to Date - Current Month',ABC), ALL('_sp-Total Invoiced to Date - Current Month'))))

 

I'm having an error:

The SUM function only accepts a column reference as an argument.

 

Thank you!!!!

7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous , You have to try return like

 

RETURN divide((CALCULATE(SUMX(Table,ABC), ALL(Table))) , (CALCULATE(SUMX(Table,ABC), ALLSELECTED(Table))))

 

or like

 

RETURN divide((CALCULATE(ABC, ALL(Table))) , (CALCULATE(ABC, ALLSELECTED(Table))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

Appreciate your response.

 

It's compiling now but it's showing incorrect output. Please see my update and let me know if I miss any thing or if my logic is not on the right track.


Thank you

@Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak,

 

My goal is something link this:

 

sample.PNG

 

I want to create the field. It will calculate the percentage between the total and the Project selected from the slicer.

 

P&L is currently a measure with a formula: 

'_sp-Total Invoiced to Date - Current Month'[Total Invoiced Current] - [Current Cost & Expense]
 
Thank you

@Anonymous , I think your return should be one of the two

 

RETURN divide((CALCULATE(ABC)) , (CALCULATE(ABC, ALL(Table))))

 

or

 

RETURN divide((CALCULATE(ABC)) , (CALCULATE(ABC, ALLSELECTED(Table))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak I also tried using REMOVEFILTERS and it's not working

Anonymous
Not applicable

@amitchandak 

 

I think we're almost there. The only problem right now is I always get 100% value regardless of what filter I selected.

 

Is there a way to not include (CALCULATE(ABC, ALLSELECTED(Table))) from filtering? 

 

Thank you

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors