Forum Discussion

mroomi's avatar
mroomi
Helper II
10 years ago
Solved

How to do OR between two columns?

Hi All,

So currently I can do an OR in filters on one column e.g, If Date is less then "1" OR Greater than "10". But I want to do an OR between two columns.

 

If [code1] is 290 OR [code2]  is 310 then do this.

 

Thanks.

 

  • there will be a smarter way but make a third column which holds your =OR() function then reference that for your measure. If something might be used as a filter or used in a relative context keep it in a column rather than a measure.

     

     

     

     

    //if this is a solution please mark as such

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Taking a guess at what you are looking for... likely this works...

     

      = CALCULATE ( [MyMeasure], FILTER (MyTable, MyTable[Code1] = 290 || MyTable[Code] = 310)

     

    • mroomi's avatar
      mroomi
      Helper II

      Thanks Scottsen,

      But I wanted to do this at report level, where user can achive this using the report level filters.

      Or else I have to create multiple measures and the biggest problem is to filter doesnt work on the visual when you use the measures.

      • Anonymous's avatar
        Anonymous
        Not applicable

        That... is going to be challenging.

         

        Hopefully somebody else chimes in with an idea.  The only thing I can think of is having lookup tables that are NOT related to your fact table (otherwise the default AND behavior will take over), then write some tricky DAX measures to filter the fact rows based on selections in the "disconnect tables" based on an OR pattern.

  • samdthompson's avatar
    samdthompson
    Memorable Member

    there will be a smarter way but make a third column which holds your =OR() function then reference that for your measure. If something might be used as a filter or used in a relative context keep it in a column rather than a measure.

     

     

     

     

    //if this is a solution please mark as such

  • samdthompson's avatar
    samdthompson
    Memorable Member

    there will be a smarter way but make a third column which holds your =OR() function then reference that for your measure. If something might be used as a filter or used in a relative context keep it in a column rather than a measure.

     

     

     

     

    //if this is a solution please mark as such