Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jcarloscandela
Contributor II
Contributor II

Stock calculation

Hello all, Im trying to calculate the daily stock throw these records:

UnitsDayInDayOut
1018/04/201920/04/2019
3019/04/201922/04/2019
2021/04/201924/04/2019

 

And I want this result table

StockDay
1018/04/2019
4019/04/2019
3020/04/2019
5021/04/2019
2022/04/2019
2023/04/2019
024/04/2019

 

Any idea? I will appreciate it!

1 Solution

Accepted Solutions
PrashantSangle

try below

base_table:
Load Units,Date(Date#(DayIn,'DD/MM/YYYY')) as DayIn,Date(Date#(DayOut,'DD/MM/YYYY')) as DayOut Inline [
Units, DayIn, DayOut
10, 18/04/2019, 20/04/2019
30, 19/04/2019, 22/04/2019
20, 21/04/2019, 24/04/2019
];

final:
load distinct
Units,
DayIn,
DayOut,
DayIn + IterNo() - 1 as Date
resident base_table
while DayIn + IterNo() - 1 < DayOut;

drop Table base_table;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

2 Replies
PrashantSangle

try below

base_table:
Load Units,Date(Date#(DayIn,'DD/MM/YYYY')) as DayIn,Date(Date#(DayOut,'DD/MM/YYYY')) as DayOut Inline [
Units, DayIn, DayOut
10, 18/04/2019, 20/04/2019
30, 19/04/2019, 22/04/2019
20, 21/04/2019, 24/04/2019
];

final:
load distinct
Units,
DayIn,
DayOut,
DayIn + IterNo() - 1 as Date
resident base_table
while DayIn + IterNo() - 1 < DayOut;

drop Table base_table;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jcarloscandela
Contributor II
Contributor II
Author

Hi Prashant, it worked perfectly. 

Ty for helping me and for the fast response.