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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
PowerDinosaur
Frequent Visitor

Conditional formatting sentences If they consist words from another column

Hi guys,

 

I have a column full of sentences [SENTENCES] and I also have a column with words [WORDS].

I would like to highlight the words in the sentences with yellow background (or If it doesnt work at least the sentences, so the whole cell) If they consist any of the words from the WORDS column.

 

Does anyone has a solution for that?

I know that it is possible with HTML visualizations, but I would like to do It without that If that's possible.

 

Thank you for your answer in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PowerDinosaur , You can have a measure like this and can use that in conditional formatting using field values option

measure =

vat _1 = countx(filter(Table, containsstring(Table[Sentence],[Word])),[Sentence])

return

if(not(Isblank(_1)) ,"Yellow", Blank())

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@PowerDinosaur , You can have a measure like this and can use that in conditional formatting using field values option

measure =

vat _1 = countx(filter(Table, containsstring(Table[Sentence],[Word])),[Sentence])

return

if(not(Isblank(_1)) ,"Yellow", Blank())

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear @amitchandak thank you for your kind help!

I had to modify It a bit to make it work, but it works nicely! (i had to use the values function before the Table name).

However I have a problem which can become quite big. I used this on a sample, which includes only 3 sentences, however it took 11 seconds to load. This measure makes 5-6 seconds of the load time. In production we have to use this usually with about 1500 sentences, but sometimes with 5000. Do you have any idea how can we make this process quite quicker?

 

Thank you in advance!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors