Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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!

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

You can use this as your expression:-

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

Thanks & Best Regards,

Kuldeep Tak



View solution in original post

9 Replies
eliran
Creator III
Creator III

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..

Not applicable
Author

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

Not applicable
Author

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)

eliran
Creator III
Creator III

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..

Not applicable
Author

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

Not applicable
Author

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

Not applicable
Author

Ok I think I found it

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

🙂

Not applicable
Author

Hi,

You can use this as your expression:-

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

Thanks & Best Regards,

Kuldeep Tak



Not applicable
Author

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