Knowledge Drop

How to filter yesterday and same day of last two weeks in custom filter, and limit these days to week days

  • 6 April 2021
  • 0 replies
  • 404 views

Userlevel 5

Last Tested: Jan 21, 2019

 

if(

#if today is between Monday and Saturday

(mod(diff_days(date(2008,01,01), now()) + 1, 7)+1)>1 AND (mod(diff_days(date(2008,01,01), now()) + 1, 7)+1)<7,

${orders.created_date} = add_days(-1, trunc_days(now())) OR ${orders.created_date} = add_days(-8, trunc_days(now())) OR ${orders.created_date} = add_days(-15, trunc_days(now())),

 

#if today is Monday

if((mod(diff_days(date(2008,01,01), now()) + 1, 7)+1)=1,

${orders.created_date} = add_days(-3, trunc_days(now())) OR ${orders.created_date} = add_days(-10, trunc_days(now())) OR ${orders.created_date} = add_days(-17, trunc_days(now())),

 

#if today is Sunday

${orders.created_date} = add_days(-2, trunc_days(now())) OR ${orders.created_date} = add_days(-9, trunc_days(now())) OR ${orders.created_date} = add_days(-16, trunc_days(now())))

)

 

 

If today is Tuesday - Saturday, then yesterday will be week days 
If today is Monday, then we have to use -3, -10 and -17 to get Friday 
If today is Sunday, then we have to use -2, -9 and -16 to get Friday

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply