4 Replies Latest reply on Aug 10, 2016 6:55 AM by RAVITEJA GUNDA

    Difference calculation

    RAVITEJA GUNDA

      I am trying using difference calculation in tableau. For the first row I want it to assume the previous value to be '0'

       

      Example:

      Day          Counter

       

               

      day 1         260

       

      day 2         265

       

      Day 3         265

       

       

      Expected result

       

      Day 1   260  (260-0)

      Day 2   5   (265-260)

      Day 3   0   (265-265)

       

       

      What I am using:

      ZN([Counter]) - LOOKUP(ZN([Counter]), -1)

       

      Result

       

      Day 1    NULL

      Day 2   5

      Day 3   0

       

      Kindly help