Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
JoannaM
Contributor III
Contributor III

Rolling last two years (24 months) in script editor

Hi all

I have this:

monthyearpcs
12019500
22019800
32019600
42019900
52019600
62019500
72019300
82019400
92019500
102019600
112019700
122019800
12020900
22020200
32020600
42020500
52020300
62020400
72020500
82020300
92020400
102020500
112020800
122020500
12021300
22021400
32021500
42021600
52021500
62021300
72021400
82021500
92021100
102021 
112021 
122021 

 

 

I need to show only the current months and then the last 23 months. Rolling bakwards two years:

102019600
112019700
122019800
12020900
22020200
32020600
42020500
52020300
62020400
72020500
82020300
92020400
102020500
112020800
122020500
12021300
22021400
32021500
42021600
52021500
62021300
72021400
82021500
92021100

 

Script:


Temp_00:
LOAD *INLINE [
month, year, pcs
1, 2019, 500
2, 2019, 800
3, 2019, 600
4, 2019, 900
5, 2019, 600
6, 2019, 500
7, 2019, 300
8, 2019, 400
9, 2019, 500
10, 2019, 600
11, 2019, 700
12, 2019, 800
1, 2020, 900
2, 2020, 200
3, 2020, 600
4, 2020, 500
5, 2020, 300
6, 2020, 400
7, 2020, 500
8, 2020, 300
9, 2020, 400
10, 2020, 500
11, 2020, 800
12, 2020, 500
1, 2021, 300
2, 2021, 400
3, 2021, 500
4, 2021, 600
5, 2021, 500
6, 2021, 300
7, 2021, 400
8, 2021, 500
9, 2021, 100
10, 2021,
11, 2021,
12, 2021,
];

I would like to do it over script editor. Can anyone help me out?

Thanks a lot.

BR, Joanna

1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Make dates using data of month year i.e makedate(Year, Month, 1) as Date and then restrict data in the backend or frontend using expression like :  >=Addmonths(Date,-24) 

 

Thanks,

Ashutosh

 

View solution in original post

2 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Make dates using data of month year i.e makedate(Year, Month, 1) as Date and then restrict data in the backend or frontend using expression like :  >=Addmonths(Date,-24) 

 

Thanks,

Ashutosh

 

JoannaM
Contributor III
Contributor III
Author

Hi Ashutosh

Thank you so much for your help.

It worked: where Date(Floor("store date"),'DD.MM.YYYY')>=Addmonths(today(1),-24)

BR, Joanna