Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have data of entry and exit by hour, I want to calculate the accumulation (Entry-Exit) in the script and have this table for example:
Hour (hh) | Entry | Exit | Accumulation |
0:00 | 295 | 199 | 96 |
1:00 | 300 | 191 | 205 |
2:00 | 286 | 204 | 287 |
3:00 | 302 | 202 | 387 |
4:00 | 284 | 194 | 477 |
5:00 | 292 | 197 | 572 |
6:00 | 302 | 198 | 676 |
7:00 | 298 | 193 | 781 |
8:00 | 292 | 196 | 877 |
9:00 | 299 | 200 | 976 |
10:00 | 157 | 98 | 1035 |
11:00 | 3 | 5 | 1033 |
How can I achieve this result?
Thanks,
Eli.
Hi,
One solution :
LOAD if(rowno()=1,(Entry-Exit),peek(Accumulation)+(Entry-Exit)) as Accumulation,* INLINE [
Hour (hh), Entry, Exit
0:00, 295, 199
1:00, 300, 191
2:00, 286, 204
3:00, 302, 202
4:00, 284, 194
5:00, 292, 197
6:00, 302, 198
7:00, 298, 193
8:00, 292, 196
9:00, 299, 200
10:00, 157, 98
11:00, 3, 5
];
output :
@Taoufiq_Zarra Thanks!!!