3 Replies Latest reply on Aug 30, 2017 12:43 AM by Ben Topper

    Aggregate Row Problem in IF Formula

    Ben Topper

      Hi All,

       

      I've got the following Tableau table which is based off the following data in excel

      I want to display the sum of the "measure" column, unless Dimension 1 = A and Dimension 2 = X, in which case it should add 1 (i.e. get 7).

       

      I tried a formula which says:

       

      IF [Dimension 1] = "A" AND [Dimension 2] = "X"

      THEN [Measure] + 1

      ELSE [Measure]

      END

       

      But this gives me 9 instead of 6 because Tableau adds 1 to each of the three rows in the database.

       

      I tried ... THEN SUM([Measure]) + 1 .... but this tells me that I can't mix aggregate and non-aggregate results in an if formula.

       

      I've created a simple packaged workbook to illustrate the problem.

       

      Thanks,
      Ben