Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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);
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 ...