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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mroomi
Helper II
Helper II

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.

 

1 ACCEPTED SOLUTION
samdthompson
Memorable Member
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

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

6 REPLIES 6
samdthompson
Memorable Member
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

// if this is a solution please mark as such. Kudos always appreciated.
samdthompson
Memorable Member
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

// if this is a solution please mark as such. Kudos always appreciated.
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)

 

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.

@mroomi

 

So far the report level filter can't acheive your requirement. You can submit your feedback on Power BI Ideas.

 

You may follow @Anonymous's advice to use lookup tables. For example, one table for code1 range and another for code2 range, use two slicers and create two measures to get the selected range number. Then apply those two measures to your DAX fomulas.

 

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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