Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
D19PAL
Creator II
Creator II

Get sales for previous monthyear MMM-YYYY

Hi,

How do I get previous monthyear figures? in script or expression

MonthYear,Figures

Jan-2023,10

Feb-2023,20

Mar-2023,30

 

In Table

MonthYear, previousMthFigures

Feb2023,10

Mar-2023,20

 

Thanks

 

 

Labels (2)
3 Replies
D19PAL
Creator II
Creator II
Author

Hi, Anyone got anything for this?

 

Thanks

brunobertels
Master
Master

hi 

try this 

[temp]:
LOAD
rowno() as RowID,
MonthYear,Figures
LOAD * INLINE 
[
MonthYear,Figures
Jan-2023,10
Feb-2023,20
Mar-2023,30
](delimiter is ',');
 
 
final:
 
LOAD
RowID,
MonthYear,Figures,
previous (Figures) as previousMthFigures
 
    resident temp Order by RowID asc ;
    drop table temp;
 
resulting temporary table 
brunobertels_0-1686913886454.png

 

 

limited table 

brunobertels_1-1686913971373.png

 

regards 

D19PAL
Creator II
Creator II
Author

Thanks, but I should of mentioned i got multiple rows for monthyear, or does your example take the distinct monthyear?

If i did this way, I'll get

Row,MonthYear

1,Jan-2023

2,Jan-2023

3,Feb-2023

Which wouldn't work.