Discussion Board for collaboration related to QlikView App Development.
I'm trying to add a variable to my data that would sum the values of all the previous month of this year + the actual month.
Here is an example :
I manage to do it in a table but i'm struggling to do it in the script pls help.
Try like below
Test1:LOAD * INLINE [Year, Month, id, Amount2021, 01, a, 102021, 02, b, 102021, 03, c, 102021, 03, d, 102021, 03, e, 102021, 04, f, 102021, 05, g, 102021, 05, h, 102021, 06, i, 10];
JoinLoad *, SumAmount+Alt(Peek('NewVariable'),0) as NewVariable;Load Year,Month, Sum(Amount) as SumAmount Resident Test1 group by Year, Month;
View solution in original post
You can use the below -
LOAD Year,Month,id,Amount,if(Year = previous(Year), Rangesum(Amount,peek([New variable])), Amount) as [New variable]FROM[<PATH>](ooxml, embedded labels, table is Sheet1);