Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX measure include specific filter

 

These are the filters that i would like to add in a DAX Measure. Is it possible? How?

 

I have one measure named "Cost" and would like to include these filters in the DAX expression.

 

  • Anonymous Try 

    OR ( ISBLANK ( 'tablename'[Part Category] ), 'tablename'[Part Category] IN { "SHW", "SSW" } ),

     

    Jing

4 Replies

  • HI Anonymous ,

     

    Can you share your measure please?

     

    Thanks,

    Pragati

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

     

    You could try a measure like 

    Cost New =
    CALCULATE (
        [Cost],
        'tablename'[Clarity Project Created Date] >= DATE ( 2016, 1, 1 ),
        'tablename'[HW/SW] = "Hardware",
        'tablename'[Part Category] IN { "SHW", "SSW" },
        'tablename'[Part TotalQuantity] >= 1,
        CONTAINSSTRING ( 'tablename'[Project Location], "PSS" )
    )
    

    Or

    Cost New =
    CALCULATE (
        [Cost],
        FILTER (
            'tablename',
            'tablename'[Clarity Project Created Date] >= DATE ( 2016, 1, 1 )
                && 'tablename'[HW/SW] = "Hardware"
                && ( 'tablename'[Part Category] IN { "SHW", "SSW" } )
                && 'tablename'[Part TotalQuantity] >= 1
                && CONTAINSSTRING ( 'tablename'[Project Location], "PSS" )
        )
    )
    

    Note that CONTAINSSTRING is not case-sensitive. If you want it to be case-sensitive, use CONTAINSSTRINGEXACT instead. 

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, this formula works by the way, can i add additional arguement in this :

       'tablename'[Part Category] IN { "SHW", "SSW" },

       

      include "Null" as filter in the Part Category. so it's gonna be Part Category = Null or SHW or SSW,

       

      how to do that?

      • v-jingzhang's avatar
        v-jingzhang
        Icon for Community Support rankCommunity Support

        Anonymous Try 

        OR ( ISBLANK ( 'tablename'[Part Category] ), 'tablename'[Part Category] IN { "SHW", "SSW" } ),

         

        Jing