Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
2 months ago
Solved

Visual calculation- Contain

Hi good day can anyone help me on my visual calculation. May colunm status contain 'OVERDUE". What i required is to turn red the word "OVERDUE" Thank you
  • rampie's avatar
    2 months ago

    In Power BI you can't directly set a colour on a text value. The way to do it is to base your formatting on a seperate field or measure that returns the colour you want, as described in the docs【920987970406761†L715-L735】.

    Here's one way to do it: create a measure that returns a hex code when the status contains "OVERDUE" and something else otherwise, e.g.:

    StatusColor =
    IF (
    CONTAINSSTRING ( SELECTEDVALUE ( 'YourTable'[Status] ), "OVERDUE" ),
    "#C00000", // red
    "#000000" // black
    )

    Add your status field to the visual, then go to the value dropdown → Conditional formatting → Font color. Choose **Field value** and point it at the StatusColor measure. The word OVERDUE will appear in red and the rest will stay black. You can extend thsi to handle other statuses too.