Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
bouderbc
Creator
Creator

How to make a filter on Month in the load Script ?

How to make a filter on Month in the load Script ?

Hi Experts,

In my data , i have four month , but i must make a filter in the load script to load only the month before the last (-1)

Example:

Month:

Load Script:

My Request:  I wanna load only the Month before the last (-1) each time in the load script, so the Month 8 in this case

Tell me how to do to make a filter on the field Month

Thank you

Regards

Ali

11 Replies
Anil_Babu_Samineni

I am referring this?

LOAD * Inline [

MonthField, SalesField

1, 10

2, 20

3, 30

4, 40

5, 50

6, 60

7, 70

8, 80

9, 90

10, 100

11, 110

12, 120

] Where MonthField = $(Variable)-1; // You can change as your needed..

LET Variable = Peek('MonthField', -1);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prieper
Master II
Master II

But then you may keep this variable:

Temp: LOAD MAX(MONTH(MyDate)) AS MaxMonth FROM ....;

LET vMaxMonth = PEEK('MaxMonth', 0, 'Temp');

DROP TABLE Month;

Data: LOAD * FROM .... WHERE MONTH(MyDate) = $(vMaxMonth) -1;

Rolling month as before. You may need to cover for an error, if there is just one month ...