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
chavanr
Resolver I
Resolver I

Filter with multiple conditions in a measure

Hi there,

 

I am trying to create a measure with multiple conditions using filter.

 

 

so if the code is 214 then exclude products abc, xyz etc ( i need to exclude 10 products from the calculation)

 

CALCULATE(
    SUM(Facttable[sales]),
    FILTER(Facttable,Facttable[Type] ="Incoming"),
   FILTER(Facttable,Facttable[Code] ="214" && Facttable[productid] <> "abc" || Facttable[productid] <> "xyz" || Facttable[productid] <> "efg" || Facttable[productid] <> "lmn" || Facttable[productid] <> "jkl" || Facttable[productid] <> "uyt" || Facttable[productid] <> "erf" )
 
Here the && condition is not excluding the sales value from calculation,
 
Cheers,

 

3 REPLIES 3
freginier
Solution Specialist
Solution Specialist

You can do something like this to exclude several products

 

Measure = CALCULATE( COUNT('Table'[Column1]); NOT( 'Table'[Column1] ) in {"A";"B";"C"})

 

 

______________________________________________________

If you found this post helpful, please give Kudos C

FreemanZ
Super User
Super User

hi @chavanr

are you expecting something like:

Measure = 
CALCULATE(
    SUM(Facttable[sales]),
    FILTER(Facttable,Facttable[Type] ="Incoming")
) -
CALCULATE(
    SUM(Facttable[sales]),
    FILTER(Facttable,Facttable[Type] ="Incoming"),
    FILTER(Facttable,Facttable[Code] ="214" 
)

 

Hi @FreemanZ  Thanks for your response 

nope, i need to include but only exclude some item from that code.

e.g. there are 20 items & want to exculde 5 from them.

 

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.