Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lg92
Contributor II
Contributor II

Cumulative Sum

Hi,

I have this table

YearDate   Amount
2019          1000
2019          20000
2018         4550
2020         45480
2019         3200
2019         23320
2021        32780
2021        12370
2021         12300
2020        24890
2018         6580
2019          68750
2020         237890
2021         21330
2021        54560

I need to develp a KPI that calculate cumulative sum by years. if i filter year = 2020, the kpi sum 2018 + 2019 + 2020.

Thanks in advanced 

Labels (2)
2 Solutions

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

Hi @lg92 ,

Maybe this:

=Sum( {< YearDate = {"<=$(=Max(YearDate))"} >} Amount )

I hope it can help.

Best Regards

View solution in original post

Taoufiq_Zarra

=sum({<YearDate={"<=$(=max(YearDate))"}>} Amount)

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
Taoufiq_Zarra

@lg92  like ?

=sum({<YearDate={"<=$(=getfieldselections(YearDate))"}>} Amount)

 

example :

Taoufiq_Zarra_0-1615198604952.png

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
lg92
Contributor II
Contributor II
Author

This solution works only if i select one year. I need that works also if i don't select any year (in this case kpi sum 2018 +2019+2020+2021 as default).
anyway thank you

agigliotti
Partner - Champion
Partner - Champion

Hi @lg92 ,

Maybe this:

=Sum( {< YearDate = {"<=$(=Max(YearDate))"} >} Amount )

I hope it can help.

Best Regards

Taoufiq_Zarra

=sum({<YearDate={"<=$(=max(YearDate))"}>} Amount)

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉