11 Replies Latest reply on Apr 11, 2018 12:58 PM by Jim Dehner

# Running Calculation

I am trying to create calculation so it is a running total of the Active Headct. I would like the total to roll over for 4 quarters. Since the total is rolling over for 4 quarters, 25% of the total will be accounted for in each quarter. For example: if the head count is 10 in quarter 1; 2.5 will be counted for quarters 1,2,3 and 4. If the total head count is 10 in quarter 3; then 2.5 will count for quarters 3,4,1,2. I've attached an example to use.

• ###### 1. Re: Running Calculation

Joe Oppelt Thank you.

• ###### 2. Re: Running Calculation

Hi

If I understand what you want this might work

set the table calculation as

In your data it returns this

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 3. Re: Running Calculation

How come quarter 4 in 2015 & Quarters 1 & 2 of 2016 aren't included?

In my actual visual, it starts with Quarter 1 when I use the windows sum, will there be different numbers for the start & end?

• ###### 4. Re: Running Calculation

the data is insufficient to look back 4 full quarters - so Tableau will insert a null

if you want Tableau to calculate the value on the available data (e.g. 25% of only a 1 value in the first quarter 25% of the first and econd in the second etc)

then unselect the checkoff box shown below

see below

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 5. Re: Running Calculation

So I was able to get this but it is not including the other quarters. I am trying to get it so where if something is in one quarter, the total rolls over for 4 quarters continuously.

• ###### 7. Re: Running Calculation

Ok help me understand again what you want - are you saying the in Q4 2015 you want 10 , and in Q1 2016 you want 30+2.5 for 32.5 and in Q2 you want 30 + 7.5+2.5 for 40

and so on?

JIm

• ###### 8. Re: Running Calculation

I would like it so it is like this:

2015

Q4: (10*.25) = 2.5

2016

Q1: (30*.25) = 7.5 +2.5 = 10

Q2 (30*.25) = 7.5 + 2.5 + 7.5 = 17.5

Q3 (30*.25) = 7.5 + 2.5 +7.5 = 17.5

Q4 (30*.25) = 7.5 +7.5 +7.5 = 22.5

2017

Q1 (10*.25) = 2.5+ 7.5 +7.5 = 17.5

• ###### 9. Re: Running Calculation

Ok

see the attached - I calculated the running total

1 time using 4 Q from the original post

and one time using 3 Q as you implied in your last post (please check your math for Q3 16)

best i can do

Jim

• ###### 10. Re: Running Calculation

Yes! From this example it is looking correct. In my visual, the first quarter listed is Q1 so the start and finish of the calculation will be different.

Another question I have why is that the start is -2 and end is 0 in the Windows Sum calc for quarterly aggregation?

• ###### 11. Re: Running Calculation

Intro to Table Calculations   3 min video

and

Modifying Table Calculations  5 min video

Jim