10 Replies Latest reply on Oct 3, 2018 1:24 PM by Deepak Rai

    Calculate difference in values between two rows

    Jack Huber

      New to Tableau so forgive me if this is an easy one:

       

      I want to calculate gains in enrollment from one year to the next, with the data in long format.

       

      School     Year     Enrollment

      St. James     2016     200

      St. James     2017     210

      St. James     2018     220

       

      I want to do something like:

      Enrollment 2017 = Enrollment WHEN Year=2017

      Enrollment 2018 = Enrollment WHEN Year=2018

      Gain = Enrollment 2018 - Enrollment 2017

       

      How to calculate this simple gain from 210 to 220?

       

      Thanks for any help you can provide.

       

      Jack