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

Expression using Rangesum

Hi,

My requirement is do do sum of below rows which I am able to achieve partially using following expression.

Expression for 'Sum Amount' is

=rangesum(Before(sum(Amount),0,4))

Product

Month

201102

201103

201104

201105

201106

201107

201108

201109

001801

Amount

125464

152019

139180

143548

153559

137264

164853

314758

001801

Sum Amount

125464

277483

416663

560211

588306

573551

599224

770434


But this expression considers only those months which are selected in the report. For ex if I select months from 201103 to 201109, expression doesn't consider month 201102.

Product

Month

201103

201104

201105

201106

201107

201108

201109

001801

Amount

152019

139180

143548

153559

137264

164853

314758

001801

Sum Amount

152019

291199

434747

588306

573551

599224

770434

My requirement is to get following even if selection is made on month

Product

Month

201103

201104

201105

201106

201107

201108

201109

001801

Amount

152019

139180

143548

153559

137264

164853

314758

001801

Sum Amount

277483

416663

560211

588306

573551

599224

770434

Can some explain me if I can achieve this at front end level, if not how to define this at script level.

rangesum(Before(sum(Amount),0,4)) doesn't work at script level.

Thanks a lot for your help

Regards

Shilpa

3 Replies
Not applicable
Author

Hello,

Can you provide some pointers on how to calculate cumulative sum of previous rows at script level.

Thanks and Regards

Shilpa

Miguel_Angel_Baeyens

Hi Shilpa,

This thread and this other one have some working examples on how to get accumulations in the script based on current record values against previous record values. Basically you will need to do a ordered load based on your criteria and create a new field that stores the accumulated value and is aclled using Peek()

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

Thanks a lot for the prompt response. I will look into the threads you suggested.

Thanks

Shilpa