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
Arranafc19
Helper IV
Helper IV

Dax Filter for equivalent of NOT IN in SQL

Hi

 

I am creating dax measures to count records by id and wondering if it is possible to use a filer similar to not in to exclude a list of ids.

 

 

See below an example of one of the dax measures that works for me where I am counting the number of product ids where the status id is 39.

 

 

Sales = calculate(Count('Status Records' [product_id]) , 'Status Records'[Status_ID] = 39)

 

I need to do similar to the above , however I need to count the number of product ids for all statuses that are not (89,74,32)

 

Anyone able to assist ?

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Arranafc19 , Try like

Sales = calculate(Count('Status Records' [product_id]) , not('Status Records'[Status_ID] in {89,74,32}))

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @Arranafc19 

 

I believe below thread could provide you hints:

https://community.powerbi.com/t5/Desktop/DAX-equivalent-of-SQL-s-NOT-IN/m-p/586184 

 

MEASURE NOT IN =
CALCULATE (
    SUM ( Table1[Value] );
    FILTER (
        Table1;
        Table1[Category] = "C"
            && NOT ( Table1[CAT LEVEL] ) IN { 2; 3 }
    )
)
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @Arranafc19 

 

I believe below thread could provide you hints:

https://community.powerbi.com/t5/Desktop/DAX-equivalent-of-SQL-s-NOT-IN/m-p/586184 

 

MEASURE NOT IN =
CALCULATE (
    SUM ( Table1[Value] );
    FILTER (
        Table1;
        Table1[Category] = "C"
            && NOT ( Table1[CAT LEVEL] ) IN { 2; 3 }
    )
)
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@Arranafc19 , Try like

Sales = calculate(Count('Status Records' [product_id]) , not('Status Records'[Status_ID] in {89,74,32}))

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.