Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team,
I have data here.
MonthCode | Sales |
201601 | 20 |
201602 | 22 |
201603 | 28 |
201501 | 19 |
201502 | 18 |
201503 | 25 |
I need to make script in qlikview to find the Previous sales and my data should look like as below.
MonthCode | Sales | PrevSales |
201601 | 20 | 19 |
201602 | 22 | 18 |
201603 | 28 | 25 |
201501 19
201502 18
201503 25
Regards
Srinivas
May be this:
Table:
LOAD Date(MonthStart(Date#(MonthCode, 'YYYYMM')), 'YYYYMM') as MonthCode,
Sales
INLINE [
MonthCode, Sales
201601, 20
201602, 22
201603, 28
201501, 19
201502, 18
201503, 25
];
Left Join (Table)
LOAD AddYears(MonthCode, 1) as MonthCode,
Sales as PrevSales
Resident Table;
May be this:
Table:
LOAD Date(MonthStart(Date#(MonthCode, 'YYYYMM')), 'YYYYMM') as MonthCode,
Sales
INLINE [
MonthCode, Sales
201601, 20
201602, 22
201603, 28
201501, 19
201502, 18
201503, 25
];
Left Join (Table)
LOAD AddYears(MonthCode, 1) as MonthCode,
Sales as PrevSales
Resident Table;