2 Replies Latest reply on Oct 19, 2017 9:15 PM by Sankarmagesh Rajan

# How to get running total using filter

*New to Tableau*

I am trying to calculate the running total for each year using my filter. I would like it to add the records of  the month selected and previous months in the year. Currently, I have to select all the months I want to add. Any help would be greatly appreciated.

• ###### 1. Re: How to get running total using filter

You can create a calculation on date if date selected is greater than this and date is less than this. This would take 2 parameters to select dates. Or you can select dates from a Range also.

• ###### 2. Re: How to get running total using filter

Hi Karessa,

Create parameter and add list as 1-12

Create calc as

if ([Months Parameter])=12 then (if last()=0 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=11 then (if last()=1 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=10 then (if last()=2 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=9 then (if last()=3 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=8 then (if last()=4 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=7 then (if last()=5 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=6 then (if last()=6 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=5 then (if last()=7 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=4 then (if last()=8 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=3 then (if last()=9 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=2 then (if last()=10 then (RUNNING_SUM(sum([Sales]))) END)

elseif ([Months Parameter])=1 then (if last()=11 then (RUNNING_SUM(sum([Sales]))) END)

END

Drag month in rows and drag this calc into text.

show parameter and select months.

Thanks

sankar