How to replace negative values with 0 in Cumulative sum calculation in Tableau?

29 Views Asked by At

I have to replace the negative values with 0 in Running sum field.

I have created a calculation, like this

IF SUM([Sales]) < 0 THEN 0 ELSE RUNNING_SUM(SUM([Sales])) END

Table calculation using "Across". But I am not getting expected result.

enter image description here

I should get the results like this: enter image description here

1

There are 1 best solutions below

0
MUFF. On

You're very close, calculate Down the table rather than Across it.

See how to transform Table Calculations in the Tableau Documentation.

Also see the Running Sum Calculation Documentation.