Forum Discussion

tracyhopaulson's avatar
tracyhopaulson
Resolver I
5 years ago
Solved

conditional formatting

Hello, I need to set conditional format to show 3 different colors as shown below in a small sample data but cannot figure out how to do it in Power BI. Can someone please help?   Thanks in advance f...
  • DataInsights's avatar
    5 years ago

    tracyhopaulson, try this measure:

     

    Formatting Color =
    SWITCH (
        TRUE (),
        [Counted] = 0
            && [Not Counted] > 0, "Red",
        [Counted] > 0
            && [Not Counted] = 0, "Green",
        [Counted] > 0
            && [Not Counted] > 0, "Yellow"
    )

     

    Steps to apply:

     

    1. Conditional formatting > Background color

    2. Format by = Field value

    3. Based on field = Formatting Color

     

    Instead of the color names, you can use color codes (e.g., #FF0000).