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

Calcualte Accumulation in script

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)EntryExitAccumulation
0:0029519996
1:00300191205
2:00286204287
3:00302202387
4:00284194477
5:00292197572
6:00302198676
7:00298193781
8:00292196877
9:00299200976
10:00157981035
11:00351033

 

How can I achieve this result?

Thanks,

Eli.

Labels (1)
2 Replies
Taoufiq_Zarra

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 :

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") 😉
EliGohar
Partner - Creator III
Partner - Creator III
Author

@Taoufiq_Zarra Thanks!!!