Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all, Im trying to calculate the daily stock throw these records:
Units | DayIn | DayOut |
10 | 18/04/2019 | 20/04/2019 |
30 | 19/04/2019 | 22/04/2019 |
20 | 21/04/2019 | 24/04/2019 |
And I want this result table
Stock | Day |
10 | 18/04/2019 |
40 | 19/04/2019 |
30 | 20/04/2019 |
50 | 21/04/2019 |
20 | 22/04/2019 |
20 | 23/04/2019 |
0 | 24/04/2019 |
Any idea? I will appreciate it!
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
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
Hi Prashant, it worked perfectly.
Ty for helping me and for the fast response.