Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
m4u
Partner - Creator II
Partner - Creator II

Conditional summing

Hi

I am trying to do something equal to a sql subquery in a line chart

Assuming I have table with two fields - date and transaction_sum (can be positive or negative)

I would like to display a chart showing the history of the open debt at each date. The open debt is the sum of all transaction sums UP TO the point of that date. What expression can I use for this case (during presentation only)

1 Solution

Accepted Solutions
Not applicable

You can define twice your date in the script

..

Date,

Date as dimDate ,

...

I have another idea for your problem

use Date as dimension,

use sum(transaction_sum) as expression

and click on "Full accumulation" in the expression menu.

Please Give feed back

JJ

View solution in original post

5 Replies
amien
Specialist
Specialist

you cant work with:

SUM(IF(DATE < transaction_sum,DEBT))

Not applicable

Why not

Sum( If ( date < dimDate , transaction_sum ))

where dimDate is your dimension, it could be given date depending of what you want to represent.

If you want to see each date on the graph, best is to create a calendar (see example on the community).

regards

jj

m4u
Partner - Creator II
Partner - Creator II
Author

Hi

This is exactly the point when I get stuck:

Sum( If ( date < dimDate , transaction_sum ))

now, date is the date field in the condition, but what is dimDate? How do I refer to the dimension variable? In my case, date is also the dimension itself..

Not applicable

You can define twice your date in the script

..

Date,

Date as dimDate ,

...

I have another idea for your problem

use Date as dimension,

use sum(transaction_sum) as expression

and click on "Full accumulation" in the expression menu.

Please Give feed back

JJ

m4u
Partner - Creator II
Partner - Creator II
Author

Thanks

I've played with both methods and got what I need