Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
I'm here again facing lots of problems trying to use QlikView...
How can I sum the last 4 values different to zero?
Check this sample chart:
Date | LOPP | This is what I'm looking for |
18/05/2020 | 0 | 3+1+5+3 = 12 |
17/05/2020 | 3 | 1+5+3+1 = 10 |
16/05/2020 | 0 | 1+5+3+1 = 10 |
15/05/2020 | 1 | 5+3+1 = 9 |
14/05/2020 | 5 | 3+1 = 4 |
13/05/2020 | 0 | 3+1 = 4 |
12/05/2020 | 0 | 3+1 = 4 |
11/05/2020 | 3 | 1 = 1 |
10/05/2020 | 1 | - |
How can I do it?
Thanks
Any Help?
Maybe you can do the expression Sum(LOPP), but in the table expression properties choose to accumulate by 4 steps.
Read more inain the Accumulation section in this help page: https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Straight_Table....
Hello Vergar, how are you?
Thanks for your help, but it's not working!
I believe the solution is easier than I'm trying to explain, but It's difficult to explain by text.
Are you available for a 30 minutes call via Skype?
Thanks for your time
One solution in
SET DateFormat='D/M/YYYY';
tab1:
LOAD * INLINE [
Date, LOPP
18/5/2020, 0
17/5/2020, 3
16/5/2020, 0
15/5/2020, 1
14/5/2020, 5
13/5/2020, 0
12/5/2020, 0
11/5/2020, 3
10/5/2020, 1
]
;
tab2:
LOAD *, RangeSum(K1, K2, K3, K4) As Last4Sum
;
LOAD *, If(Peek('LOPP')=0,Peek('K1'),Peek('LOPP')) As K1
, If(Peek('LOPP')=0,Peek('K2'),Peek('K1')) As K2
, If(Peek('LOPP')=0,Peek('K3'),Peek('K2')) As K3
, If(Peek('LOPP')=0,Peek('K4'),Peek('K3')) As K4
Resident tab1
Order By Date
;
Drop Table tab1;
Script: