Forum Discussion

tebtim19's avatar
tebtim19
Icon for Helper IV rankHelper IV
4 years ago
Solved

color formatting text

I have a status text value'

A

B

C

D

 

How can I use a color formatting value based on the text

 

A = yellow

B = Blue

C = Pink

D = Black

  • Hi tebtim19 ,

     

    It is not possible to use metric values for multiple columns because the calculation logic of formulas in powerbi is based on rows and not columns.
    It is only possible to manually convert column names to text types by creating a public form to reflect them in the formula.

    just like above:

    Color Measure =
    VAR _A =
        MAX ( table[text value column] )
    RETURN
        SWITCH (
            _A,
            "A", "Yellow",
            "B", "Blue",
            "C", "Pink",
            "D", "Black",
            "E", "Red",
            "F", "Green"
        )

    You can also refer to my other reply:

    Growing Excel Sheet as Data Source - Microsoft Power BI Community


    If the problem is still not resolved, please point it out. Looking forward to your reply.


    Best Regards,
    Henry


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

3 Replies

  • Hi tebtim19 

     

    It depends on how you want to use that Color Formatting, but you can create a measure like this and use that in the color formatting:
    Color Measure =
    Var _A = MAX(table[text value column])
    return
    Switch(_A, "A","yellow","B","Blue","C","Pink","D","Black")

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

     

    • tebtim19's avatar
      tebtim19
      Icon for Helper IV rankHelper IV

      Hi thank you this is really helpful,

      One more thing. I have a lot of columns should i do this one by one in each column or is there a way to use only one measurement to all columns?

      • v-henryk-mstf's avatar
        v-henryk-mstf
        Icon for Community Support rankCommunity Support

        Hi tebtim19 ,

         

        It is not possible to use metric values for multiple columns because the calculation logic of formulas in powerbi is based on rows and not columns.
        It is only possible to manually convert column names to text types by creating a public form to reflect them in the formula.

        just like above:

        Color Measure =
        VAR _A =
            MAX ( table[text value column] )
        RETURN
            SWITCH (
                _A,
                "A", "Yellow",
                "B", "Blue",
                "C", "Pink",
                "D", "Black",
                "E", "Red",
                "F", "Green"
            )

        You can also refer to my other reply:

        Growing Excel Sheet as Data Source - Microsoft Power BI Community


        If the problem is still not resolved, please point it out. Looking forward to your reply.


        Best Regards,
        Henry


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