Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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
sunny_talwar

So, essentially you don't want to load any data for the max month? Is this for only the current year or all the years?

prieper
Master II
Master II

LOAD * FROM .... WHERE MONTH(MyDate) = MONTH(TODAY() -1);

If you need a logic over the end of the year, you may convert the monthes into rolling monthes,

i.e.

LOAD * FROM .... WHERE YEAR(MyDate) * 12 + MONTH(MyDate) = YEAR(TODAY() * 12 + MONTH(TODAY() -1);

bouderbc
Creator
Creator
Author

Hi Sunny,

is only for the current Year , and in my Data i have always 4 months , and i have to load only the month before the last (Max)

So in this case Max is 09 = September , i want to load only 08= August

Each time when i load the new Data , i want to have only the  month (-1) before the last one (Max)

bouderbc
Creator
Creator
Author

Hi Peter ,

is only for the current Year , and in my Data i have always 4 months , and i have to load only the month before the last (Max)

So in this case Max is 09 = September , i want to load only 08= August

Each time when i load the new Data , i want to have only the  month (-1) before the last one (Max)

Anil_Babu_Samineni

You need to create one variable to pick the Max Month value and then required to use Where condition using

Load * From Table Where Mois <= $(Variable)-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
PrashantSangle

loveisfail I think you are suggesting >= $(Variable)-1

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anil_Babu_Samineni

No, Because he need till last month data. If we give >=$(Variable)-1 it loads only Current and Last months data i believe..

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
PrashantSangle

Opps my mistake I'm suggesting = $(Variable)-1

because he wants only previous month data.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
bouderbc
Creator
Creator
Author

Hi Anil,

Can you tell me All  the steps to  make the variable and where to put it in the Load

Thank You