3 Replies Latest reply on Aug 5, 2014 7:22 AM by Noah Salvaterra

    Dynamic conditional color formatting in scatter plots

    Florian Jätzold

      Dear community,

       

      in a scatter plot, I would like to have all points below the average colored red. E.g., say we have a plot of sales price vs. time, I would like to have every price below the average sales price colored red.

       

      A static solution would be a calculated field, e.g

       

      IF [sales price] < 30.000

      THEN "Too Cheap"

      ELSE "Price ok"

      END

       

      This can be dragged on "Color" in the marks section. As a result, every sales price below 30.000 would get a different color from the prices >= 30.000.

       

      However, I would like to have the coloring dependent on the average of the sales price, and not of the static value of 30.000. Trying

       

      IF [sales price] < avg([sales price])

      THEN "Too Cheap"

      ELSE "Price ok"

      END

       

      returns an error as Tableau doesn't allow for mixing aggregate and non-aggregate arguments. Dynamic coloring in dependence of the average sales price is important as the average might change due to filtering (e.g., examining the sales of one product group only instead of all product groups at one time).

       

      Do you have any suggestions how to tackle this issue?