Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
please help with scenario,
if user selected a month exclude the dates flowing in other month week
As below
let vStartDate= '2021-01-01';
let vEndDate= '2021-12-31';
temp_Calendar:
Load
Date
,MonthName(Date) as CalendarMonth
,Week(Date) as IsoWeek
;
Load
date(date#('$(vStartDate)','YYYY-MM-DD')+Iterno()-1) as Date
AutoGenerate 1
while date#('$(vStartDate)','YYYY-MM-DD') +Iterno()-1 <= date#('$(vEndDate)','YYYY-MM-DD');
Left Join (temp_Calendar)
Load IsoWeek,Mode(CalendarMonth) as WeekMonth
Resident temp_Calendar
Group by IsoWeek
;
Calendar:
Load
*
,if(CalendarMonth=WeekMonth,1,0) as flag_WeekInSameMonth
Resident temp_Calendar;
drop table temp_Calendar;
then use flag_WeekInSameMonth in set analysis
sum({<flag_WeekInSameMonth ={1}>}Amount)
can you explain by way of example for clarity
this is exactly what the flag created in above script does, have you tried it yet?