Forum Discussion

mmace1's avatar
mmace1
Icon for Impactful Individual rankImpactful Individual
7 years ago
Solved

DAX equivalent of SQL's NOT IN?

There's an extremely similar equivalent for SQL's IN - I have no imagination, so an example extremely similar to the last one I actually wrote:    Card Sales = CALCULATE ( [total valid spend], ...
  • MFelix's avatar
    7 years ago

    Hi mmace1,

     

    You need to place the NOT formula on the column and then use the in to make the level you need.

     

    So you measure should look something like this:

    MEASURE NOT IN =
    CALCULATE (
        SUM ( Table1[Value] );
        FILTER (
            Table1;
            Table1[Category] = "C"
                && NOT ( Table1[CAT LEVEL] ) IN { 2; 3 }
        )
    )

    As you can see below in category C the total is 1500 if you took out the category 2 and 3 it's 1000.

     

     

    Regarrds,

    MFelix