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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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}))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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}))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors