Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, i created a calendar
MasterCalendar_tmp:
Load
TempDate AS Data_DP,
week(TempDate) As Week,
Year(TempDate) As Year,
num(Month(TempDate)) As Month,
Day(TempDate) As Day,
YeartoDate(TempDate)*-1 as CurYTDFlag,
YeartoDate(TempDate,-1)*-1 as LastYTDFlag,
inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
I need to select all friday, then put them in increasing order, and then put a flag for identify the friday that is from a different month to the previous one. Someone can help? Thanks
Hi, you can try something like this:
//loading only fridays and ordering by Data_DP
calendar_temp:
NoConcatenate
LOAD
*,
num(WeekDay(Data_DP)) as weekday_num
RESIDENT MasterCalendar_tmp
WHERE num(WeekDay(Data_DP))=4
ORDER BY Data_DP;
//adding flag separately as previous() functuion not working in above part
calendar:
NoConcatenate
LOAD
*,
if(Month<>previous(Month), 'flag', 'no') as flag
RESIDENT calendar_temp;
DROP TABLES MasterCalendar_tmp, calendar_temp;