Forum Discussion

krishb1414's avatar
krishb1414
Helper III
3 years ago
Solved

Color Formatting directly to column

Hi Everyone, 

I have to color format based on range as shown in below image, If it is 0-20 then Green, 20-30 then Amber and > 30 then red. But when i try to use FX in color format then if i select a column (particular range) then it will take aggregate automatically as shown in 2nd image. 

 

And also,I tried to write a measure, but measure doesn't read column directly, so i can't able to write it.

 

Please help me how to do color format in this scernario. Its very urgent.

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  krishb1414 ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    SWITCH(
        TRUE(),
        MAX('Table'[Range])="0-20","#4CAF50",
        MAX('Table'[Range])="20-30","#FFC107",
        MAX('Table'[Range])="30-100","#f44336")

    2. Go to the Background color interface.

    Format style – Field value

    Select [Color]

    3. Result:

     

    Best Regards,

    Liu Yang

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

3 Replies

  • Hey krishb1414 ,

     

    I must admit that I do not understand what you want to achieve. Please provide a pbix file that contains sample data but still reflects your data model (tables, relationships, calculated columns, and measures). Upload the pbix to onedrive, google drive, or dropbox and share the link. Describe the requirement based on the sample data you provide.

    If you want to keep your solution more dynamic, then it is helpful creating a table that contains two columns (left bound and right bound) instead of a single column.

     

    I'm also wondering about the color you want to use if the value is

    20, 

    30 or above 

    100.

     

    Regards, 

    Tom

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  krishb1414 ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    SWITCH(
        TRUE(),
        MAX('Table'[Range])="0-20","#4CAF50",
        MAX('Table'[Range])="20-30","#FFC107",
        MAX('Table'[Range])="30-100","#f44336")

    2. Go to the Background color interface.

    Format style – Field value

    Select [Color]

    3. Result:

     

    Best Regards,

    Liu Yang

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

    • krishb1414's avatar
      krishb1414
      Helper III

      Hi, 

       

      It means you entered values statically in measure, what if I change values in column (Range Column)

      For example Instaed of "0-20" to "0-10"  or "20-30" to "10-20". It will be blank or no color right.

       

      So, what do i do in such scenario ? 

       

      Please help me in this cases.