7 Replies Latest reply on Nov 7, 2013 7:11 PM by Ramon Martinez

# Rolling Sum for linegraph

Hi,

Attached sample workbook. I have sum (points) as a measure and date as a dimension. I created a line graph for lost/won game.

In the graph i already created sum(points) for won game and lost game. i would like to add also the rollingsum(points) for Won game only in the same graph. Please help.

• ###### 1. Re: Rolling Sum for linegraph

Hi,

You can create a calculation like below for the rollingsum(points) for Won game only

RUNNING_SUM(Sum(If [Lost/Won Game]='Won Game' then [Points] End))

OR

you can use dual axis method.

Please find the attached workbook with both examples.

• ###### 2. Re: Rolling Sum for linegraph

Hi Love,

Follow the steps to solve the problem:

1.- Create a calculated field Runningsum for Won Game with formula:

RUNNING_SUM(IIF(ATTR([Lost/Won Game])=="Won Game",SUM([Points]),Null))

2.- create a dual axis graph by adding Runningsum for Won Game to Rows shelf

3.- The tab calcl Define Runningsum for Won Game is Compute using Table (Across)

4.- Right-click on vertical right axis and select Synchronize Axis

5.- Right-click on vertical right axis and click on Show Header

See the attached.

Best

Ramon

• ###### 3. Re: Rolling Sum for linegraph

TQ all..This is working. Sorry one more question--how can i do moving calculation..moving along next 3 values?

• ###### 4. Re: Re: Rolling Sum for linegraph

Hi Love,

Yo need to apply Moving Average Table calculation over the pill SUM([Points]) in the Column self.

See worksheet Sheet 3 in the attached workbbok

Best,

Ramon

• ###### 5. Re: Re: Rolling Sum for linegraph

Ramon,

3 Per moving average is not working for running sum . It works alone for sum(points). I want sum(points) for lost game, sum(poinrs) for win game and running_sum(points) for win game line graphs in one sheet.

Attaching screenshot

• ###### 6. Re: Re: Re: Rolling Sum for linegraph

Now you get it.

See the attached, Sheet 3

best

Ramon

• ###### 7. Re: Rolling Sum for linegraph

Hi Love Tableau,

Did you have the opportunity to review the workbook posted in my last post?