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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
George87
New Member

CALCULATE DOES NOT FILTER AS INTENDED

Good day all, I am new to PB and I am having problems in obtaining a value that is the difference between demand and capacity for a given region.

The goal is to create a measure that gives the difference value between demand and capacity for a given region (in the example APAC), regardless of external filters (applied in region slicer). I have used CALCULATE, but it only works for me when in the external slicer I mark the APAC region, otherwise it looks blank.

 

George87_1-1719997019139.png

 

George87_2-1719997030193.png

 

If I am right, CALCULATE is supposed to remove the pre-existing filters and apply the filter you set to, but in my case, it doesn't work.

I hope you can help me to find the error I am making. Thank you in advance

 

1 ACCEPTED SOLUTION

Hi,

You can use ALL to remove only the location: ALL( [<table> | <column>[, <column>[, <column>[,…]]]] )

[Sales all locations] = CALCULATE(SUM('Master Capacity'[weekly capacity]), ALL('Master Capacity'[location]))








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ValtteriN
Community Champion
Community Champion

Hi, 

You need to add function such as ALL or REMOVEFILTERS: 
ALL function (DAX) - DAX | Microsoft Learn
CALCULATE function (DAX) - DAX | Microsoft Learn
REMOVEFILTERS function (DAX) - DAX | Microsoft Learn

In addition to this I recommend having separate measures which you would refer in this measure. E.g. 
[Sales all] = CALCULATE(SUM('Master Capacity'[weekly capacity]), ALL('Master Capacity'))

[Sales selected] =SUM('Master Capacity'[weekly capacity])

[Sales apac] = CALCULATE(SUM('Master Capacity'[weekly capacity]), ALL('Master Capacity'),'Location'[[location region] (groups)]="APAC")

[Sales diff] = [Sales selected] - [Sales apac]

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi ValtteriN, Thank you for your answer. But if I use ALL, is it not removing all the externals filters applied? I would like to remove only the external filter "Location" (Location slicer) and then set in the formula the region I want, but keep the other external filters applied. Do you think is any way to do it?

Hi,

You can use ALL to remove only the location: ALL( [<table> | <column>[, <column>[, <column>[,…]]]] )

[Sales all locations] = CALCULATE(SUM('Master Capacity'[weekly capacity]), ALL('Master Capacity'[location]))








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.