Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
PrashantSangle

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

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
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..

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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.
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