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
giacomoghezzi
New Member

Calculate Function in a measure doesn't filter all the data out

Hi,

I'm new to the community and I'm experiencing an unexpected error in Power BI. I'm working for a client and going through their sales data, which is split by regions.

 

As I would like to compare the sales volume in one region to the sales volume of all regions except that one across time I've built a line chart visualization with date on the x axis and the following values:

 

- Values:

 

Volume A = Calculate([Total Volume],(Sales[Region]="A"))
Volume (Excl. A) = SUMX(Sales,IF(Sales[Region]<>"A",Sales[Total Volume],0))
 
Now, when I build my line chart, and I add a slicer for the regions to also be able to see how other regions do (with Volume excl.a), I see that Volume A is never 0 as it should (given the filter of the  measure should prevail on the slicer), but rather some small quantities.

Can anyone help me figure out why? 

Thank you very much,

Giacomo
 
 
 
 
 
 
8 REPLIES 8
v-lili6-msft
Community Support
Community Support

hi  @giacomoghezzi 

If you could use this formula as below:

Volume (Excl. A) = CALCULATE(Sales[Total Volume],Sales[Region]<>"A")

or

Volume (Excl. A) = CALCULATE(Sales[Total Volume],FILTER(Sales,Sales[Region]<>"A"))

 

If not your case, could you please use dummy data to do a simple sample pbix file and share it and your expected output, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

Thank you. Unfortunately I cannot post the sample data as it's client data and I've signed a NDA :(, otherwise I would have...

Best,

G

MFelix
Super User
Super User

Hi @giacomoghezzi ,

 

First of all try to change your measure to:

Volume (Excl. A) = SUMX(FILTER(Sales, Sales[Region]<> "A" ),[Total Volume]))

This may be  related with a variety of issues from missinformation in your database to syntax in formula, to relationships.

 

Probably you need to go and filter out information what I ussualy do with this cases is place the information in a table and then start to add details, in your case sales region, dates, .... and so on until you get the detail of what is having impact on your calculation.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you, 


I'll give that a try!!

Does the above reply helps. Else create a sample data and sample output in table format and provide.

 

make me @

Appreciate your Kudos.

yogeshmaney
Helper I
Helper I

can you share a snapshot or power bi file

Hi Yogeshmaney,

Thanks for your reply. Unfortunately I can't as it's sensitive data :(.


Best, 

Giacomo

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.