Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
sfernamer
Helper III
Helper III

Customized colours based on the measures represented

Hi everyone!

 

For my visualizations, I'm comparing the same KPI with a difference:

 

- The KPI only based on last performace.

- The KPI based on all performances excepted the last one.

 

As you can see in the image, I show both KPI measures with a dimension in Y-axis but I would like to change the green colour (the colour of the KPI - Last Performance) for a conditional colour based in:

 

- If KPI Last Performance > KPI Average, bar colour = red. (Worse performance than avg)

- If KPI Last Performance < KPI Average,  bar colour = green. (Better performance than avg)

 

Could you tell me, please, if this is possible in Power BI? 

 

Thanks in advance.

 

Graph.png

1 ACCEPTED SOLUTION

Hi , @sfernamer 

Thanks for your quick response!

I test it in my side , When we put the two fields on the value , we can not set the conditional format color for it, this feature only be used in one field. If we want to custom the color , we can only add a dimension in it , like this:

Type2<5 = var _type2 = CALCULATE( SUM('Table'[Value]) , 'Table'[Type]= "Type2")

return

IF(_type2<=5,_type2,BLANK())
Type2>5 = var _type2 = CALCULATE( SUM('Table'[Value]) , 'Table'[Type]= "Type2")

return

IF(_type2>5,_type2,BLANK())

Then we can configure the color in this:

vyueyunzhmsft_0-1673225704628.png

And the result will be:

vyueyunzhmsft_1-1673225719346.png

 

 

For your need , i can not find the conditional format the color for the multy-fields on the bar chart . You can post your idea to Power Ideas to make this product more and more perfect.

Ideas (powerbi.com)

 

Best Regards,

Aniya Zhang

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

View solution in original post

5 REPLIES 5
v-yueyunzh-msft
Community Support
Community Support

Hi , @sfernamer 

According to my testing and research, conditional formatting is actually suitable for bar charts to some extent, for example, you can see my example, I defined a measure here to manually output the name of the color I want to output for your bar chart according to the rules:

Color =

 SWITCH(

     TRUE(),

     SELECTEDVALUE('Table'[Column2])>=2,"Green",

     SELECTEDVALUE('Table'[Column2])<2,"Red",

     "White")

Then I applied this corresponding measure to the conditional formatting of the bar chart, like this

vyueyunzhmsft_0-1672887965326.pngvyueyunzhmsft_1-1672887972811.png

Then you can achieve your needs, you can first try to click this button to see if the direct UI interface settings can achieve your needs, and then decide according to your situation whether to manually write the measurement value output color name logic according to my method above.

vyueyunzhmsft_2-1672887990408.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Thank you @v-yueyunzh-msft for your time and your reply.

 

For what I see, your example is based on a bar chart representing one measure. What I'm looking for is to use the conditional formatting for one measure when representing two, like my first graph. Idk if it's possible in Power BI. 

 

Thank you for your time.

Hi , @sfernamer 

Thanks for your quick response!

I test it in my side , When we put the two fields on the value , we can not set the conditional format color for it, this feature only be used in one field. If we want to custom the color , we can only add a dimension in it , like this:

Type2<5 = var _type2 = CALCULATE( SUM('Table'[Value]) , 'Table'[Type]= "Type2")

return

IF(_type2<=5,_type2,BLANK())
Type2>5 = var _type2 = CALCULATE( SUM('Table'[Value]) , 'Table'[Type]= "Type2")

return

IF(_type2>5,_type2,BLANK())

Then we can configure the color in this:

vyueyunzhmsft_0-1673225704628.png

And the result will be:

vyueyunzhmsft_1-1673225719346.png

 

 

For your need , i can not find the conditional format the color for the multy-fields on the bar chart . You can post your idea to Power Ideas to make this product more and more perfect.

Ideas (powerbi.com)

 

Best Regards,

Aniya Zhang

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

sfernamer
Helper III
Helper III

Hi @FreemanZ 

 

Firstly, thanks for your reply. I tried conditional formatting but it's not working with bar graph. It's true that I can use it the conditional format in table (image 1) so the conditional format measure works but I have no chance to add the measure created to define the colour of the bar graph.

 

Could you tell me, please, if it's possible to use it with bar graphs or other more visual graphs than a table? Thank you in advance.

 

Cond_Format1.pngCondFormat2.png

FreemanZ
Super User
Super User

hi @sfernamer 

yes, with conditional formating. You can write measures to dynamically apply that. like this:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Conditional-formatting-using-dax/m-p/2134755#...

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.