Discussion Board for collaboration on QlikView Scripting.
I have data as below and want to create another field "P3Sales" it would have values of previous three months(including current month) group by FiscalYrMth, PL,CBN for all the months. I mentioned values for some rows need for your refer.
Please help me to fix the issue
Is this only done where PL = PL001? or was that just for demonstration?
I need for all. Just mentioned for understanding what value should come each row
May be try this:
LOAD RowNo() as Key,
(html, codepage is 1252, embedded labels, table is @1);
If(PL = Previous(Previous(PL)) and CBN = Previous(Previous(CBN)), RangeSum(Sales, Previous(Sales), Previous(Previous(Sales))),
If(PL = Previous(PL) and CBN = Previous(CBN), RangeSum(Sales, Previous(Sales)), Sales)) as P3Sales
Order By PL, CBN, FiscalYrMth;
DROP Table Table;