Search code examples
chartsconditional-formattingtableau-desktop

How do I color bar charts in Tableau depending on average per pane?


enter image description here

I would like to color the bars per pane depending if they are below or above the average per pane. I can only achieve this relative to the total average, not relative to the average per pane as shown by the red dotted line... Is their a way to do this?


Solution

  • Create a calculated field called "Color" like this:

    if sum([Sales]) >= WINDOW_AVG(SUM([Sales]))
    then 'greater'
    else 'lesser'
    end
    

    Remember to compute the CF for your more granular field (in this case sub-category), right-clicking on its pill (Compute using).

    You should get something like this in the superstore:

    enter image description here