Forum Discussion

s_mansell's avatar
s_mansell
Helper I
6 years ago
Solved

Filtering Out Category

Hi all, 

 

Is there a way I can use and opposite of the 'IN' function to filter a measure? I have previously used a quick measure to filter my value e.g. 

 

Sales filterd out 'B'=
CALCULATE(
    [Sales],
    'Cost Account'[Category] IN {
        BLANK(),
        "A",
        "C",
        "D",
        "E"})
 
This does work however the list of categories will change meaning the value won't be correct if any changes to the list occur.
Instead I am looking to filter out 'B' rather than keep in all other categories e.g.
Sales filterd out 'B'=
CALCULATE(
    [Sales],
    'Cost Account'[Category] OUT {
        BLANK(),
        "B"})
 

How can I write this correctly? 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi s_mansell ,

     

     

    You can write this as 

     

    Sales filterd out B=
    CALCULATE(
        [Sales],
    NOT
        'Cost Account'[Category] IN {
            BLANK(),
            "B"})
     

    Regards,
    Harsh Nathani

    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi s_mansell ,

     

     

    You can write this as 

     

    Sales filterd out B=
    CALCULATE(
        [Sales],
    NOT
        'Cost Account'[Category] IN {
            BLANK(),
            "B"})
     

    Regards,
    Harsh Nathani

    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi  s_mansell 

    You could use not in logic in dax, but it is this syntax NOT <column/expression> IN {list}

    it is like harshnathani's reply.

     

     

    Regards,

    Lin