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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cumulative sum

Hi all,

     I have a table which is shown below :

    

DateWorkingDate

Sales

11100
210
33
42300
53500
64900

I want to show the cumulative Sales by WorkingDate and the Sales of non-WorkingDate must be sumed to their nearest workingdate (the nearst workingdate must be greater than the non-workingdate). That's to say the sales of date 2 and date 3 will be sumed to workingdate 2.

The correct result table would like this :

WorkingdateCumulativeSales
1

100

2413
3913
41813

thanks.

Zhou

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

Regards,

Jagan.

View solution in original post

9 Replies
jagan
Partner - Champion III
Partner - Champion III

HI,

Use Workingdate as Dimension in Straight table and Sum(CumulativeSales) as expression and select

Full Accumulation option in Expression tab of Chart Properties.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi Jagan, Thanks for you prompt response. I did as you suggested while the result table is below: the non-workingdate's sales is been ignored.

Capture.PNG


angelaecheverri
Creator
Creator

From the script you can do it..

Data1:

Load

Date,

WorkingDate,

Sales

From

Data.xls

Data2:

Load

Date                           as Date2,

WorkingDate               as WorkingDate2,

Sales                          as Sales2,

Sales + peek(Sales)     as SalesAcum

Resident Data1

Order by Date asc;

angelaecheverri
Creator
Creator

If you need an specifc order like you load... could be...

Data1:

Load

Date,

WorkingDate,

Sales,

autonumber() as ID

From

Data.xls

Data2:

Load

Date                           as Date2,

WorkingDate               as WorkingDate2,

Sales                          as Sales2,

Sales + peek(Sales)     as SalesAcum,

ID

Resident Data1

Order by ID asc;

jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

Regards,

Jagan.

angelaecheverri
Creator
Creator

How can i Attach it i dont know how...

jagan
Partner - Champion III
Partner - Champion III

Hi,

Click on Use Advance Editor option on top of the reply text box.

Regards,

Jagan.Attach.png

Not applicable
Author

Thank you Jagan, it works. But i choose to do it manually because of the complexity of my real data. Thanks.

Not applicable
Author

Thanks for your help. I have worked it out as Jagan suggested. Your solution is the same as his.