Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
kirsten_dc
Partner - Contributor II
Partner - Contributor II

Flag for an entire month when a day is already flagged

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

1 Solution

Accepted Solutions
sunny_talwar

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;

View solution in original post

2 Replies
sunny_talwar

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;

kirsten_dc
Partner - Contributor II
Partner - Contributor II
Author

After some very small adjustments it worked for me.

Great! Thanks!!!