Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Conditional color formating in a column chart with 2 measures

Hello,

 

I am trying to change the color of the columns in a Line & clustered column chart with a conditional formula.

It's working just fine when there is just 1 measure in the column y-axis. 

 

Is there a way where I could do conditionnal formating when there is 2 measures for the column y-axis?

 

Thank you for your help. 

 

 

 

3 Replies

  • Hi Anonymous ,

    Unfortunately, Power BI by default does not support conditional formatting for multiple value in column charts.

     

    See related topic here

    Please consider to vote this idea here

     

     

  • Anonymous You can try using


    Expand the "Data colors" section.
    You will see the measures listed under "Columns". Click on the fx button next to the measure you want to apply conditional formatting to.
    In the "Default color" dialog that appears, choose "Field value" under "Format by".
    Select the field that contains the conditional formatting logic. This field should return a color value based on your conditions.


    If you have two measures, repeat the above steps for the second measure.
    By setting up a field that returns color values based on your conditions, you can apply different colors to each measure in the chart. This approach allows you to handle multiple measures with conditional formatting in Power BI.

    If you need to create a field that returns color values, you can use a DAX formula to define the logic. 

     

    ColorMeasure =
    SWITCH(
    TRUE(),
    [YourMeasure] > 500000, "Red",
    [YourMeasure] > 100000, "Yellow",
    "Green"
    )
    This DAX formula will return "Red" if the measure is greater than 500000, "Yellow" if it is greater than 100000, and "Green" otherwise. You can then use this field for conditional formatting.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Could you show where is the "data colours" section you mentionned? Can't seem to find it