Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
reshmakala
Creator III
Creator III

Eliminating rows that are in last 2 business days

Hi All,

I have data where I need to remove records that have date in the last 2 business days. Please help me with this. Attached is the sample.

Thank you!

1 Solution

Accepted Solutions
sunny_talwar

You have data for 01/25/2016 (Mon) so do you want to see 01/25/2016 and 01/22/2016 excluded?

Try this:

=Only({<Date -= {"$(=Date(Max({<WeekDay -= {Sat, Sun}>}Date), 'MM/DD/YYYY'))", "$(=Date(Max({<WeekDay -= {Sat, Sun}>}Date, 2), 'MM/DD/YYYY'))"}>}Value)

Where WeekDay is created in the script:

LOAD *,

  WeekDay(Date) as WeekDay

INLINE [

Date, Value

01/16/2016, 200

01/17/2016, 100

01/18/2016, 430

01/19/2016, 456

01/20/2016, 679

01/21/2016, 547

01/22/2016, 455

01/23/2016, 345

01/24/2016, 466

01/25/2016, 656];


Capture.PNG

View solution in original post

4 Replies
sunny_talwar

This may be?

=Only({<Date = {"$(='<' & Date(Max(Date, 2)))"}>}Value)

Capture.PNG

reshmakala
Creator III
Creator III
Author

Hi Sunny,

Thank you for your solution. Here 01/24/2016 is not a weekday and so I would need to eliminate 01/21/2016 and 01/22/2016 from the table.

sunny_talwar

You have data for 01/25/2016 (Mon) so do you want to see 01/25/2016 and 01/22/2016 excluded?

Try this:

=Only({<Date -= {"$(=Date(Max({<WeekDay -= {Sat, Sun}>}Date), 'MM/DD/YYYY'))", "$(=Date(Max({<WeekDay -= {Sat, Sun}>}Date, 2), 'MM/DD/YYYY'))"}>}Value)

Where WeekDay is created in the script:

LOAD *,

  WeekDay(Date) as WeekDay

INLINE [

Date, Value

01/16/2016, 200

01/17/2016, 100

01/18/2016, 430

01/19/2016, 456

01/20/2016, 679

01/21/2016, 547

01/22/2016, 455

01/23/2016, 345

01/24/2016, 466

01/25/2016, 656];


Capture.PNG

reshmakala
Creator III
Creator III
Author

Thank you so much!