2 Replies Latest reply on Mar 28, 2013 1:34 PM by sira.sasitorn

    Table Calc - Taking value from the row above

    sira.sasitorn

      Hi,

       

      I'm trying to convert a formula in Excel to Tableau calculations. For example, in the attached spreadsheet, I'm trying to convert column C formula into Tableau syntax. However, I don't know if it is possible to reference the row above. For example, the logic to calculate column C is:

       

                A               B                    C                        D

      611/28/2012153153
      711/28/2012246246
      711/28/20122460

       

      If the value in column A is the same as the value above in column A (A2 = A1), and, value in column B is the same as the value above in column B (B2 = B1), then, take the previous value (column C 1) + column D (D2) value. Else column D2.

       

      In the example above, the 3rd row is the only row that is true (A3 = A2 and B3 = B2), so I'll take 246 (previous column C value) + 0 (column D value). Second row is partially true so column C value will be the same as column D.

       

      In the sample Tableau file, I tried to use the lookup function to reference the row above, but got calculation errors. What is the syntax for the calculation above?

       

      Any help would be appreciated