9 Replies Latest reply: Oct 25, 2010 8:10 AM by Roland Kunle

# Collecting the sum of fields

Hi! I'm pretty new to QV and would like to write a script that does the following:

I have a table with two fields : one date field and one value field - there can be more than 1 row per date with different values for each row.

I want to create a new table where a row = the date field + the sum of all value fields for that date PLUS the sum of the balance fields for all previous dates.

Hope some one can help me with this :) Thanks!

• ###### Collecting the sum of fields

Build a table that It's dimension will be the date, the expression is sum(value)

In the expression mark 'Expression Total'

And I think you'll get what you want.

Give it a try..

• ###### Collecting the sum of fields

Thanks! but no that just gives me the total for each date. I want the total for each date PLUS the total for all previous dates in the table

• ###### Collecting the sum of fields

If the original table looks like this for example:

Date1 - 100
Date1 - 200
Date2 - 300
Date2 - 100
Date3 - 500

The new table should look like :

Date1 - 300
Date2 - 700 (400+300)
Date3 - 1200 (500+700)

• ###### Collecting the sum of fields

Ok I think I found it

In a straight table you can select Full Accumulation on the Sum(value) expression and it works

:)

• ###### Collecting the sum of fields

Hi mauich,

perhaps you can remember. Take a glance at the straight table expression rangesum. It is similar to the solution of Kuldeep Tuk.

Regards, Roland

• ###### Collecting the sum of fields

Hi,

I got your meaning..

Go to properties - Presentation - datefield - and flag 'Show Partial Sums'

The more fields you add it to, the more partial sums you'll have ofcourse..

• ###### Collecting the sum of fields

Okay, I tried that but it still just shows the total for each date, not adding the other sums. I'm using "=Sum(Value)" as expression and the datefield as dimention, have tried both pivot table and straight table

• ###### Collecting the sum of fields

Maybe something with RangeSum would work? Can't figure out how though...

• ###### Collecting the sum of fields

Hi,

You can use this as your expression:-

rangesum(above(sum(Value),0,rowno()))

Thanks & Best Regards,

Kuldeep Tak