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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Khramana
Frequent Visitor

Conditional expression with OR question

Hello Power BI masters!

I faced with a difficulty to make the right conditional expression with logic "OR".
I have table like this:

Ticket numberTitleDescriptionKeyword
1234I like bananasbananas are the bestApples
12345I like bananasbut apples moreApples
54321I like applesand nothing moreApples


I want to add an additional column to my table which will check whether columns Title or Description contains any word in Keyword column. If any of them contains it - then 1. If noone contains - then 0.

I can check it perfectly checking in 1 column like:
Table.AddColumn(#"Expanded Keywords", "Custom", each if Text.Contains([Description], [KeyWords.1]) then 1 else 0)

But I don't fully understand how to add "OR" condition here correctly.
May be  "IN" needs to be used here... but I'm a bit lost... 
Could you please advise?

Thank you very much in advance!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use

Table.AddColumn(#"Expanded Keywords", "Custom", each if Text.Contains([Description], [KeyWords.1]) or Text.Contains([Title], [KeyWords.1]) then 1 else 0)

Since you have got case-sensitivity

= Table.AddColumn(#"Renamed Columns", "Custom", each if Text.Contains([Description], [Keyword.1], Comparer.OrdinalIgnoreCase) or Text.Contains([Title], [Keyword.1], Comparer.OrdinalIgnoreCase) then 1 else 0)

 

View solution in original post

4 REPLIES 4
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use

Table.AddColumn(#"Expanded Keywords", "Custom", each if Text.Contains([Description], [KeyWords.1]) or Text.Contains([Title], [KeyWords.1]) then 1 else 0)

Since you have got case-sensitivity

= Table.AddColumn(#"Renamed Columns", "Custom", each if Text.Contains([Description], [Keyword.1], Comparer.OrdinalIgnoreCase) or Text.Contains([Title], [Keyword.1], Comparer.OrdinalIgnoreCase) then 1 else 0)

 

Thank you, @Vijay_A_Verma  but it's strange, that in case of 2nd formula use, it adds the whole initial table too (double the initial table + adds a custom column).
Also custom column often shows an error inside or only 0. But there are tickets that have the word "Apples" inside. Do you know what could go wrong? 

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Replace #"Renamed Columns" with your previous step.

I want to see some sample data where it shows error or 0?

I guess I found out a possible reason why it could happen - if one of the columns is blank - in this case it showed error.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.