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

Rangesum with Peek function

I want to capture the total number of orders per day. I have tried with the below script but I couldn't able to achieve it. Could anyone of us help me to fix this?

 

Table1:
Load * Inline
[
Date,Number of Orders/Returns
2019-01-01,100
2019-01-02,25
2019-01-02,-30
2019-01-03,10
2019-01-03,-15
2019-01-04,20
2019-01-04,-10
];

NoConcatenate

Test:
Load
Date,[Number of Orders/Returns],
RangeSum([Number of Orders/Returns],Peek(Orders)) as TotalOrders
Resident Table1
Order by Date;
drop table Table1;
exit Script;

4 Replies
Taoufiq_Zarra

@arusiva89  are you looking for ?

Table1:
Load * Inline
[
Date,Number of Orders/Returns
2019-01-01,100
2019-01-02,25
2019-01-02,-30
2019-01-03,10
2019-01-03,-15
2019-01-04,20
2019-01-04,-10
];

output:

load Date,count([Number of Orders/Returns]) as TotalOrders resident Table1 group by Date;

drop table Table1;

output:

Capture.PNG

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi what you need is cumulative sales in script. Find some useful links.

https://community.qlik.com/t5/QlikView-Scripting/Running-Sum-on-Load-Script/td-p/536661

https://community.qlik.com/t5/QlikView-App-Development/Rangesum-Running-Balance-by-Dimension/m-p/132...

https://community.qlik.com/t5/New-to-Qlik-Sense/Running-total-per-dimension/td-p/1542119

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
arusiva89
Contributor III
Contributor III
Author

`No,I want to sum the number of orders per day

Kushal_Chawda

@arusiva89  why don't you simply use  sum( Number of Orders/Returns) as expression?