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

View all the Fabric Data Days sessions on demand. View schedule

Reply
AzarShaik-8386
Frequent Visitor

Power BI conditional formatting highlight specific text in each row for table visual

Hi Power BI Community,

I have a table visual in Power BI where one of the columns contains text data. I would like to highlight specific text in different rows, where the text to be highlighted changes per row. For example:

  • In Row 1, I want to highlight the word "urgent."
  • In Row 2, I want to highlight the word "critical."
  • In Row 3, I want to highlight the word "info," and so on.

I understand that Power BI’s native conditional formatting allows for entire cells or rows to be highlighted, but I am looking for a way to apply different text-based rules to highlight specific values in different rows of the table visual. Is there a method or workaround that would allow me to achieve this level of granularity?

Here’s what I’ve tried so far:

  • I’ve created a DAX measure using SWITCH(TRUE()) to check for specific text values in each row and apply conditional formatting based on those values.
  • However, this ends up highlighting the entire row or cell instead of just the specific text.

Is there a way to highlight only the relevant text within a cell or apply cell-level conditional formatting differently per row?

Thanks for any guidance or suggestions!whatsapp2.jpegWhatsApp Image 2024-09-20 at 8.32.06 PM.jpeg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AzarShaik-8386 ,

I create a simple table as you mentioned.

vyilongmsft_0-1727057390219.png

Then I create a calculated column and here is the DAX code.

HighlightedText = 
SWITCH(
    TRUE(),
    'Table'[RowID] = 1, SUBSTITUTE('Table'[TextColumn], "urgent", "<span style='background-color:yellow'>urgent</span>"),
    'Table'[RowID] = 2, SUBSTITUTE('Table'[TextColumn], "critical", "<span style='background-color:red'>critical</span>"),
    'Table'[RowID] = 3, SUBSTITUTE('Table'[TextColumn], "info", "<span style='background-color:green'>info</span>"),
    'Table'[TextColumn]
)

So I think you can use the visual named HTML Content.

vyilongmsft_1-1727057636469.png

vyilongmsft_2-1727057671235.png

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
Anonymous
Not applicable

Hi @AzarShaik-8386 ,

I create a simple table as you mentioned.

vyilongmsft_0-1727057390219.png

Then I create a calculated column and here is the DAX code.

HighlightedText = 
SWITCH(
    TRUE(),
    'Table'[RowID] = 1, SUBSTITUTE('Table'[TextColumn], "urgent", "<span style='background-color:yellow'>urgent</span>"),
    'Table'[RowID] = 2, SUBSTITUTE('Table'[TextColumn], "critical", "<span style='background-color:red'>critical</span>"),
    'Table'[RowID] = 3, SUBSTITUTE('Table'[TextColumn], "info", "<span style='background-color:green'>info</span>"),
    'Table'[TextColumn]
)

So I think you can use the visual named HTML Content.

vyilongmsft_1-1727057636469.png

vyilongmsft_2-1727057671235.png

 

 

 

Best Regards

Yilong Zhou

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

lbendlin
Super User
Super User

Use SVG to achieve that.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors