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
MurielT
Frequent Visitor

How to use the OR Operator with DAX

Hi

Can someone please help me to capture the accurate expression on DAX.

I would like to use the OR operator for multiple values like below but sounds I do something bad as I have an error message.

Thanks,

 

FILTER (
'Product'[Product Line Identifier] = "6J" ||
'Product'[Product Line Identifier] = "2C" ||
'Product'[Product Line Identifier] = "KV")
)

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

@MurielT

 

Hi,

It seems something is wrong with the other part of your formula. Please post your formula here. You can replace the confidential part. Or maybe you can try operator “in” like this: 'Product'[Product Line Identifier] in {“6J”, “2C”, “KV”}  (Values in brace).

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-jiascu-msft
Employee
Employee

@MurielT

 

Hi,

It seems something is wrong with the other part of your formula. Please post your formula here. You can replace the confidential part. Or maybe you can try operator “in” like this: 'Product'[Product Line Identifier] in {“6J”, “2C”, “KV”}  (Values in brace).

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Dale

 

Thanks a lot

 

It works now !

 

Have a nice day

Muriel

 

@MurielT

 

My pleasure.

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
KHorseman
Community Champion
Community Champion

Your OR statement is perfectly fine. You've just left out the first argument of your FILTER function.

 

FILTER(<table>, <conditional statement>)

 

 

What you've done is

 

FILTER(<conditional statement>)

 

So you should write

 

FILTER (

'Product',
'Product'[Product Line Identifier] = "6J" ||
'Product'[Product Line Identifier] = "2C" ||
'Product'[Product Line Identifier] = "KV")
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for your reply

However it does not work.

My Table is "Product"

My field is "Product Line Identifier"

 

May I need to add a function like EVALUATE ?

 

Thanks

Muriel

 

Additional Informations

 

Those are columns ( Not measures)

 

I need to select lot of different Values of Product Line Identifier.

 

Howeer, when I sue the Equal Operator and select on the drop down list all the different values I need, it does not work.

 

That's why I try to cover it thru another way but i'm not enough knowledgeable in DAX to generate a correct OR Expression.

 

Thanks

Muriel

 

Formula? I can't tell you what to change if I can't see what it is.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




No you do not need EVALUATE. Show me the full formula you're using, not just the FILTER part. Is it a measure or a column?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.