Forum Discussion
Conditional formatting for bar chart
Hello everyone!
I have a simple bar chart with a line.
the bar shows me the actual sales per day and the line shows me the budget.
is there any chance to get a red bar if the sales were for the corresponding day below the line/ budget?
Best Regards
3 Replies
- amitchandakSuper User
joshua1990 , Create a measure which returns, diff between Atual and Budget , And use that for rule-based conditional formatting
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting
https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
https://exceleratorbi.com.au/conditional-formatting-using-icons-in-power-bi/
https://community.powerbi.com/t5/Desktop/FORMAT-icon-set-for-use-in-a-data-card/td-p/811692- joshua1990Post Prodigy
Thanks, for your reply!
Please, read my post carefully. I am not looking for conditional formatting in a table.
I am looking for changing the color of bars in a bar chart...
- TomMartensSuper User
Hey joshua1990 ,
this measure returns the name of a color that should be applied to a bar if a certain condition is met:
fill Color = IF(DIVIDE([Total Sales Amount (PY)] , [Total Sales Amount]) >= 1.2 , "red" , BLANK())This article lists the colors that are supported: https://blog.crossjoin.co.uk/2018/08/10/colour-names-supported-in-power-bi-conditional-formatting/
It's also possible to provide the hexcode of color using e.g "#ba3811".
Here is a visual:I applied the measure to the Default color of the Data colors well of the chart:
I selected this rule
Hopefully, this is what you are looking for.
Regards,
Tom