Forum Discussion

AzarShaik-8386's avatar
AzarShaik-8386
Frequent Visitor
1 year ago
Solved

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 chan...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi AzarShaik-8386 ,

    I create a simple table as you mentioned.

    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.

     

     

     

    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.