Color bars in bar chart with conditional formatting

I have bar chart as seen in pic below and 2 reference lines. I want to color the bars based on their avg value of field local_fuel_uplift_percent so that when it is above 95 bars should be green, yellow when between 95 and 90 and red if below 90. Is there a way to do that in Quicksight?

Thx!
Fotis

Hi @Fotis_flex,
While setting up conditional formatting on bar charts is currently not an available feature, there is a work around that could potentially work in this scenario.
Since you can add an additional field to the color section, you could do this through building a calculated field that places your results in ‘buckets’. So create an ifelse that buckets your results into your desired groupings (<95 have it equal ‘High’ or ‘Group 1’, etc.).
Then you can use that calc. field in your color section and assign colors to the group/bucket values.

I’ll also mark this as a feature request as it would be nice to setup conditional formatting on visuals other than tables!

Hi @Brett

I tried this by creating field with formula below. However, QS does not allow me to insert this field in the Group/Color section giving “Custom aggregation field is not allowed in this section”. Can you perhaps think of anything else? It’s a bit disappointing not to be able to achieve this.

But many thanks for your help anyways!

ifelse(
    avg({local_fuel_uplift_percent}) > 95,
    'Green',
    ifelse(
        avg({local_fuel_uplift_percent}) >= 90,
        'Yellow',
        'Red'
    )
)

Try:

ifelse(
avgOver({local_fuel_uplift_percent},[{Departure Airport (ICAO)}], PRE_AGG) > 95,
1,0
)

If this works, then you can adapt it to your case :slight_smile:

[quote=“Bartosz, post:4, topic:52486”]
ifelse(
avgOver({local_fuel_uplift_percent},[{Departure Airport (ICAO)}], PRE_AGG) > 95,
1,0
Super, that worked. Not able to pass the string green, yellow, red but at least I get the colors. Thanks a lot!