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
Anmolgan
Post Prodigy
Post Prodigy

Filter out value from a DAX measure?

I want to write a dax formula for calculating volume, by filtering out sales group 011, 010, 009.

 

After that I want to filter out below values from the above mesaure:

 

filter out customername and below are my customer name that I want to filter out and also fiter out 010.

 

Filter out

Customer A

Customer B

 

How to write this dax in order to get correct result?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Anmolgan 

In your statement above you are INcluding all values by sales group

try

Measure = CALCULATE(SUM(ZSD_MAT_MARGIN_Q003[Sales Volume KL]), FILTER(ZSD_MAT_MARGIN_Q003, 
(ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01]= "011" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "010" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "009") && [Customer] <> "Value A" && [Customer] <> "Value B"
))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
az38
Community Champion
Community Champion

Hi @Anmolgan 

data model is not clear from your definition, but try something like 

Measure =
CALCULATE(
SUM([Value]);
FILTER(ALL('Table');NOT ('Table'[Sales Group] IN {"009","010","011"}) && NOT('Table'[Sales Group] IN {"Customer A","Customer B"}))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38  I had created below measure for filtering out sales group 

Measure = CALCULATE(SUM(ZSD_MAT_MARGIN_Q003[Sales Volume KL]), FILTER(ZSD_MAT_MARGIN_Q003, ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01]= "011" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "010" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "009"))
 
How can add my defenation here which says, do not include values that comes in customer table:
 
Value A
Value B
az38
Community Champion
Community Champion

@Anmolgan 

does your table ZSD_MAT_MARGIN_Q003 have a relationship with Customer table?

If so, it could be enough to add in filter statement || RELATED([Customer]) = "Value A" like this

Measure = CALCULATE(SUM(ZSD_MAT_MARGIN_Q003[Sales Volume KL]), FILTER(ZSD_MAT_MARGIN_Q003, ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01]= "011" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "010" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "009" || RELATED('Customer Table'[Customer]) = "Value A" || RELATED('Customer Table'[Customer]) = "Value B"))

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38  Everything is present in my table, I only have 1 table, why I should use RELATED I dont want to include those values in my existing dax, I want to exclude those values.

az38
Community Champion
Community Champion

@Anmolgan 

In your statement above you are INcluding all values by sales group

try

Measure = CALCULATE(SUM(ZSD_MAT_MARGIN_Q003[Sales Volume KL]), FILTER(ZSD_MAT_MARGIN_Q003, 
(ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01]= "011" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "010" || ZSD_MAT_MARGIN_Q003[Sales group.Sales group Level 01.Key]= "009") && [Customer] <> "Value A" && [Customer] <> "Value B"
))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.