Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conditional formatting on horizontal bars

Hi,

 

I am using a horizontal bar diagram that shows sales per hour. The blue bar is today and the yellow one is LY.

 

I would like the currently blue bar to be either green or red depending on the LY. 

 

For example, I want the 8th and 10th hour bar to be red and the 9th to be green.

 

Is this possible?

 

  • Hi Anonymous ,

    In the bar chart, if there is only one bar, in the visualization format pane>Bars>Colors, there is fx button in which you can use the conditional formatting measure. But if there are more than two bars in the visual, the fx button will disappear, so your expected result can't be achieved.

    However, you can create a table visual, and put the hour column in it, then you can conditional format the table visual in the visualization format>cell elements.

    Then get this result.

    I attach the sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

     

3 Replies

  • truptis's avatar
    truptis
    Community Champion

    Hi Anonymous ,

    Create a flag column which says if the value is lower than that column then 1 else 0

    & Then do the conditional formatting of data colours which says if the value is 1 then it should be red else green

     

    Anonymous -> please mark this as solution and hit the thumbs up if it helps you. Thank you. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your answer! 

       

      I have already created that flag measure but how do I use in the below visual?

       

       

      I have used "flag measures" like the ones you describe to conditional format measures in tables before so I am familiar with it but I don't understand how to use with this particular visual.

       

       

      • v-yanjiang-msft's avatar
        v-yanjiang-msft
        Community Support

        Hi Anonymous ,

        In the bar chart, if there is only one bar, in the visualization format pane>Bars>Colors, there is fx button in which you can use the conditional formatting measure. But if there are more than two bars in the visual, the fx button will disappear, so your expected result can't be achieved.

        However, you can create a table visual, and put the hour column in it, then you can conditional format the table visual in the visualization format>cell elements.

        Then get this result.

        I attach the sample below for reference.

         

        Best Regards,
        Community Support Team _ kalyj

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