Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Flag Last 5 Working Days

Hi,

I have a field : actual_date

Is it possible when loading the data to set a flag against this date if it falls within the last 5 working days upto midnight of last night?

Eg

Data is reloaded at 7am on a Wednesday morning.  I would need the 'Last 5 Days Flag' to cover

  • Wednesday
  • Thursday
  • Friday
  • Monday
  • Tuesday

Many thanks for you help

Tom

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Something like this perhaps:

LOAD

     actual_date,

     if( firstworkday(today()-1, 5) <= actual_date and actual_date < today(), 1, 0) as IsInLast5Days

FROM ...


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Something like this perhaps:

LOAD

     actual_date,

     if( firstworkday(today()-1, 5) <= actual_date and actual_date < today(), 1, 0) as IsInLast5Days

FROM ...


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

In the load script add something like :

if ( [actual_date] > today() -5 , 1 , 0 )     as [Last5DayFlag] ,

Not applicable
Author

many thanks,

Works perfectly