6 Replies Latest reply on Mar 18, 2013 10:16 AM by david.berrie

    Calculate a Conditional Average

    david.berrie

      I want to be able to calculate an average based on the underlying data that makes up the calculation.  In simple terms, I need to exclude any value that is considered an 'outlier'.

       

      I'm fairly new to tableau, and cannot seem to get the calculation logic to work correctly.

       

      I'm using a parameter so that I can allow someone to either include or exclude the outlier values.

       

      Here's what I want to do:

       

      IF [Outlier_Parameter] = 'Include'

         THEN  AVG([number_of_days])

       

      ELSE  AVG([number_of_days]) WHERE [number_of days] >2 and [number_of_days] <40

       

      END

       

      Can anyone help with my syntax here?

       

      Thanks