Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
techen1
Contributor
Contributor

Expression: Cumulative sum with "group by" and "order by"

Hello,

I'm quite new in the Qlik World and need some help with an expression.

I would like to calculate a cumulative sum over 1 dimension (YYYY-MM). The calculation for the cumulative sum needs to be ordered by sales date. The result should be like in the columen "**bleep**. sum"

 

Order YYYY-MM sales date value **bleep**. sum 
a 2022-01 15.01.2022 100.000,00 € 100.000,00 €
b 2022-01 17.02.2022 180.000,00 € 280.000,00 €
c 2022-01 16.02.2022 40.000,00 € 320.000,00 €
d 2022-02 28.02.2022 10.000,00 € 10.000,00 €
e 2022-02 04.03.2022 20.000,00 € 30.000,00 €
f 2022-02 10.04.2022 50.000,00 € 80.000,00 €

 

Thank you for help

Labels (1)
3 Replies
techen1
Contributor
Contributor
Author

Thank you for your reply.

Your solution brings sadly one disadvantage. In my understanding, the cumulative sum would be wrong if i set another dimension filter on my dashboard. Is there any way to solve this issue with an expression?

 

The solution must be more dynamic

techen1
Contributor
Contributor
Author

i want to use the expression as part of a larger calculation. This is the reason why I need it as a written expression.

do you see any possibility?

vinieme12
Champion III
Champion III

As below

Main:
LOAD * INLINE
[
Order;YYYY-MM;sales date;value
a;2022-01;15.01.2022;100000
b;2022-01;17.02.2022;180000
c;2022-01;16.02.2022;40000
d;2022-02;28.02.2022;10000
e;2022-02;04.03.2022;20000
f;2022-02;10.04.2022;50000
](delimiter is ';');

 

In Chart:

sum( aggr( rangesum( above( sum(value),0,rowno(total)) ),[YYYY-MM],Order))

 

qlikCommunity1.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.