1 Reply Latest reply on Apr 3, 2017 5:11 PM by msa s

    for every record calculated field that is the sum of the last n-months

    Bill Immer

      Hi Group,

       

      I would like to create a calculated field that is the sum of the last 12 months.  The dataset has one row for each month with the part ID and the quantity sold that month.  I'd like to add a column that is the total sold over the previous 12 months - so that each row will have a field that is the sum of the current row and the 11 rows above it:

       

      In the image, the last column, last row is the sum of "Qty Sold" in the previous 12 months, and so on...  I created this using the actual data in SQL, but I wondered if it could be done directly in Tableau with a calculated field.  Note that I'd also like another column that is the average of the "Ending OHB" going back 3 months.

       

      Thank you