Forum Discussion
Conditional Formatting bar chart visual breaks during filtering
Hello,
I made a simple bar chart visual showing the Percent to Plan for a picker and conditionally formatted the bars to be green if greater than or equal to 100% and red if below 100%.
The below data is the aggregation of an entire week broken down by work area.
On a separate table on the same page, I have the same data broken up by day and when I click on one of the days, the rest of the data filters accordingly.
This is where my conditional formatting breaks and will show a red bar for a work area that is over 100% or green bar that is less than 100% following the week aggregation value instead of the filtered aggregation for the particular day.
Yes I found the solve and its actually pretty simple. You need to find the "edit interactions" button which can be found by first clicking on the date table that is doing the filtering. From there you should see the format option appear between "help" and "Data/Drill"
After you click on edit interactions each visual will have a small popup that looks like this(highlighted):
The options that you are given from left to right are filter, highlight, and none. For our purposes, you are going to want to select filter option and then you should see the conditional formatting work with that particular interaction between visuals. You will have to do this with each visual that you want to use as a filter since the default is to highlight instead of filter like we want. Hope that helps.
8 Replies
- amitchandakSuper User
Can you share the rule? I prefer create a color measure and use that under conditional formatting by using field and measure
Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
- bogilvieiiiFrequent Visitor
Hi amitchandak
I set the conditional formatting to format by "Field Value" and based it off my "Background Color" which is the following:
Background Color = if(P4P[Percent to Plan]>=1,"Light Green",if(P4P[Percent to Plan]>=.001,"Red",""))The %2P measure is defined as such:Percent to Plan = divide(sum(P4P[lines]),sum(P4P[Hours]))/average(P4P[Expected_Rate])For good measure here is the structure of the data:(The blacked out column is userid's )Thanks for the links, I'm going through them now.
- v-xicaiCommunity Support
Hi bogilvieiii ,
Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.
Best regards
Amy
- jpurdueFrequent Visitor
bogilvieiii I'm currently running into the same issue. Did you ever fix yours? I have a bar chart with a measure color conditioning applied to it. When not filtered, it's fine. When filtered, it breaks.
my color conditioning is set up for field value and my field is "color 2" which is below.
color 2 = IF(VALUE(Kalmar[Fleet CMPH])>=14.10,"green","red")I know the measure works correct because I can place this column in a table and it'll work perfectly.- bogilvieiiiFrequent Visitor
Yes I found the solve and its actually pretty simple. You need to find the "edit interactions" button which can be found by first clicking on the date table that is doing the filtering. From there you should see the format option appear between "help" and "Data/Drill"
After you click on edit interactions each visual will have a small popup that looks like this(highlighted):
The options that you are given from left to right are filter, highlight, and none. For our purposes, you are going to want to select filter option and then you should see the conditional formatting work with that particular interaction between visuals. You will have to do this with each visual that you want to use as a filter since the default is to highlight instead of filter like we want. Hope that helps.
- jpurdueFrequent Visitor
Oh jesus that was it?! Thanks!!!!
- jpurdueFrequent Visitor
I've tried "SWTICH" too.
color 2 = SWITCH(TRUE(),AND(Kalmar[Fleet CMPH] >= 0, Kalmar[Fleet CMPH] < 14.1), "Red",AND(Kalmar[Fleet CMPH] >= 14.1, Kalmar[Fleet CMPH] < 50), "Green")- bogilvieiiiFrequent Visitor
your previous measure works fine no need to change it. Just follow the steps I laid out in my previous reply back to you