4 Replies Latest reply on Jul 25, 2013 11:22 PM by buildstar

# Sum of Rows and display in new column

Hi All,

As shown in the image I need to arrive at values displayed in C column:

In C column 1370311 value is arrived by adding A column from row 1 to 5

The second value 1206853 is derived by adding A column from row 2 to 5

Similarly rest of the values are computed.

I also need to compute values for rows 7 -10 using same logic,

I am trying and have been helped with this formula.However there is a variation in the values.

WINDOW_SUM( sum(field), 0,LAST())

How can I build a calculation the does this.

Thanks

• ###### 1. Re: Sum of Rows and display in new column

Not the most elegant solution, but then I'm only on my first cup of coffee:

IF INDEX()<=5 THEN WINDOW_SUM(SUM([Sales] ),0,5-INDEX() )

ELSEIF INDEX() > 5 AND INDEX() <= 10 THEN WINDOW_SUM(SUM([Sales] ),0,10-INDEX() )

END

(See attached) There's probably a better way to do this so the 5, 10 aren't hard-coded. I'll think about it on my flight home.

--Shawn

• ###### 2. Re: Sum of Rows and display in new column

try this..

WINDOW_SUM (sum([Profit]) )-RUNNING_sum(sum([Profit]) )

• ###### 3. Re: Sum of Rows and display in new column

Hmm...does not seem to work for me

• ###### 4. Re: Sum of Rows and display in new column

Shawn...I am using the formula you provided and it works fine....However though the rows have correct values...the subtotal is not computing correctly.

Need you help with the subtotal computation.

Thanks