
1. Re: Calculations on cumulative data
David Li Aug 19, 2016 8:45 AM (in response to Artur Pogorzelski)1 of 1 people found this helpfulHi Artur! When you say that you're working on "cumulative data", do you mean that the value stored in your data source for each week includes the sum of all previous weeks? And do you have a packaged workbook you can share with us?
Off the top of my head, I think the best way is to back into the noncumulative values. If you can't do this before the data gets into Tableau, you can do it within Tableau by creating a calculated field like this:
SUM(Sales)LOOKUP(SUM(Sales), 1)
As long as your level of detail is down to weeks and you compute along weeks, this should give you the weekly values. Then, you can just do a rolling sum of this new calculated field that resets every quarter.
This will also help you with other calculations where you need the weekly values.

2. Re: Calculations on cumulative data
khalid norat Aug 19, 2016 8:48 AM (in response to Artur Pogorzelski)Can you share a larger screen shot so we can see what fields you are using on your graph
also the definitions of any calculated fields like [week 13 net new]
you should be using
Max(if quarter = Q1 then [netNew] end)
If you can share the required details
or even better a sample workbook. Loaded with sample data if need be.
I can help you achieve the desired result

3. Re: Calculations on cumulative data
Andrew Watson Aug 19, 2016 9:03 AM (in response to Artur Pogorzelski)You should be able to use the RUNNING_SUM advanced options and tell it restart every Quarter.

4. Re: Calculations on cumulative data
David Li Aug 19, 2016 9:12 AM (in response to Andrew Watson)I'm not sure if RUNNING_SUM will work since his source data is already essentially a cumulative running sum. But maybe he misspoke and meant "aggregated" instead of "cumulative". Hard to say without seeing the data.

5. Re: Calculations on cumulative data
Andrew Watson Aug 19, 2016 11:07 AM (in response to David Li)Yes, quite right David. Artur, please help us to help you by posting some of your data.

6. Re: Calculations on cumulative data
Andrew Watson Aug 19, 2016 11:57 AM (in response to Andrew Watson)I've mocked something up to try and do this. First step is to deconstruct the cumulative values back to the daily to allow a running_sum to be done.
Create a calculated field to get the previous value, LOOKUP(SUM([Amount]),1)
Next we want to minus that value from the current value to calculate the contribution from the day only:
IF FIRST() = 0 THEN SUM([Amount]) ELSE SUM([Amount])[PreviousValue] END
Note the FIRST() = 0  this is saying if it's the very first value  i.e. not yet cumulative  then keep that value as it is, otherwise take the current value and minus the previous.
Next calculated field is the Running_sum on the above: RUNNING_SUM([AboveCalc]). Tableau 10 screenshot below telling it to restart (In my mock up data I had day to month rather than week to qtr):
Tableau 10 workbook of this mock up attached.

DeconstructCumulative_AW.twbx 38.6 KB


7. Re: Calculations on cumulative data
Artur Pogorzelski Aug 22, 2016 5:11 AM (in response to David Li)Hi David,
Thanks for your reply. Yes, each week is a running sum of the weeks before it. I've used the formula you suggested to strip the data back to distinct weekly. How would I now go about making it cumulative but restart from 0 every quarter?
Unfortunately I can't open your workbook because I'm still running an older version of Tableau.

8. Re: Calculations on cumulative data
Andrew Watson Aug 22, 2016 5:47 AM (in response to Artur Pogorzelski)1 of 1 people found this helpfulCreate a RUNNING_SUM of your weekly value. Then you need to go into the Advanced settings of the Compute Using. It looks different to the screenshot above in older versions of Tableau. I'm trying to go from memory, you want to put the Quarter and Week fields to the right (I think it's the 'addressing' box) of your Advanced options, leave 'At the level' as deepest and 'Restarting every' Quarter (your Quarter field).