5 Replies Latest reply on Nov 23, 2016 5:44 AM by David Li

# A difficult calculation in Tableau: Decay

Hi There!

I can't make the calculation attached in Tableau. Any help?

I'm trying to create a new column using another column as reference.

The task is to create a kind of "moving average" using 50% of the row before my actual row plus my actual row but not considering this math for the first row of data.

Here is a simple example:

Column A     New Column            Explanation of the task

10                       10                         (Dont consider the math)

20                         25                        (50% of 10 +20)

50                         63                         (50% of 25 +50)

15                         46                          (50% of 63 +46)

• ###### 1. Re: A difficult calculation in Tableau: Decay

Hi Fabio! Try this table calculation:

[Column A] + PREVIOUS_VALUE(0)/2

Compute this along Column A.

1 of 1 people found this helpful
• ###### 2. Re: A difficult calculation in Tableau: Decay

Hi David

The problem is the first row, I should not consider the first row.

Any other tip?

Tks

• ###### 3. Re: A difficult calculation in Tableau: Decay

I've just tried David's formula and it works. What results are you seeing and how are they unexpected?

• ###### 4. Re: A difficult calculation in Tableau: Decay

Sorry, I tried again and worked. The problem was that I was using STACK MARKS ON and them I could see correctly.

The problem was that I was using STACK MARKS ON and them I could see correctly.

Thank you guys!

• ###### 5. Re: A difficult calculation in Tableau: Decay

Happy to help!