Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear community,
I have the following problem:
Some days do not have sales. I already flagged these days in my script.
LOAD
if(IsNull(Sales),1,0) as DayFlag,
Date
RESIDENT Temp;
Now, I also need to flag the entire month when there is a day without sales (respectively there is a flagged day in that month).
Are there any suggestions how to solve my problem?
Thanks in advance,
Kirsten
May be like this:
Table:
LOAD
if(IsNull(Sales),1,0) as DayFlag,
Date,
MonthName(Date) as MonthYear
RESIDENT Temp;
Left Join(Table)
LOAD MonthYear,
If(Sum(DayFlag) = (MonthEnd(Floor(MonthYear)) - MonthStart(Floor(MonthYear))), 1, 0) as MonthFlag
Resident Table
Group By MonthYear;
May be like this:
Table:
LOAD
if(IsNull(Sales),1,0) as DayFlag,
Date,
MonthName(Date) as MonthYear
RESIDENT Temp;
Left Join(Table)
LOAD MonthYear,
If(Sum(DayFlag) = (MonthEnd(Floor(MonthYear)) - MonthStart(Floor(MonthYear))), 1, 0) as MonthFlag
Resident Table
Group By MonthYear;
After some very small adjustments it worked for me.
Great! Thanks!!!