3 Replies Latest reply on Sep 12, 2016 10:30 AM by Andrew Watson

# current period average and previous period average - calculations

I want to write two calculations. one that gives me the sum of a measure for the last 13 weeks and another that gets me a sum of the measure for the previous 13 weeks.

• ###### 1. Re: current period average and previous period average - calculations

Last13Weeks: IF [Date] >= DATEADD('week',-13,TODAY()) THEN [Measure] END

13WeeksPriorToLast13: IF [Date] >= DATEADD('week',-26,TODAY()) AND [Date] < DATEADD('week',-13,TODAY()) THEN [Measure] END

Something like that should work for you.

• ###### 2. Re: current period average and previous period average - calculations

I am getting the same values for each calculation...

• ###### 3. Re: current period average and previous period average - calculations

Let's try and put some actual dates as I expect they'd be evaluated by Tableau:

Las13Weeks: IF [Date] >= #13 June 2016# THEN [Measure] END

13WeeksPriorToLast13: IF [Date] >= #14 March 2016# AND [Date] < #13 June 2016# THEN [Measure] END

I don't know you data but the calculations are different.