Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to load data from tables based on a condition. On every day, data should be loaded from table x, but on the fourth Friday data should be loaded from table y. And so continue for the 8th Friday, the 12th and beyond (once in 4 weeks).
I tried to use the Weekday function and two variables, where the first counts every fourth week, and the second gets 1 when the table y needs to be loaded.
I would love to get more ideas.
Thanks.
You might find some other examples to do this but this is how I did it
Here is the load script using sample data:
LOAD
*,
MonthStart(Date) as MonthStartDate,
Num(weekday(Date)) as MonthStartWeekDay,
Date-MonthStart(Date) + 5 - Num(weekday(MonthStart(Date))) as DaysSinceFirstFriday,
if ( (Date-MonthStart(Date) + 5 - Num(weekday(MonthStart(Date)))) / 7 =4, 'Yes','No') as [4thFridayCheck],
weekday(Date) as Weekday,
Date-MonthStart(MakeDate(2024,3,27)) as DaysSinceStartOfMonth;
LOAD *
INLINE [
Date
3/1/2024
3/2/2024
3/3/2024
3/4/2024
3/5/2024
3/6/2024
3/7/2024
3/8/2024
3/9/2024
3/10/2024
3/11/2024
3/12/2024
3/13/2024
3/14/2024
3/15/2024
3/16/2024
3/17/2024
3/18/2024
3/19/2024
3/20/2024
3/21/2024
3/22/2024
3/23/2024
3/24/2024
3/25/2024
3/26/2024
3/27/2024
3/28/2024
3/29/2024
3/30/2024
3/31/2024];