Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want the Last30Days flag to include Order from the last 30 days up to today, starting from today (not from a fixed date like November 30), also for same Last15Days Flag.
When I select the 'Last 15 Days' flag, it shows dates starting from December 8, but I want it to show dates from December 15. Similarly, when I select the 'Last 30 Days' flag, the dates start from November 30. Please correct this issue.
The Last30Days flag will always capture Order within the last 30 days relative to today's date.
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 7, 'Last7Days',
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 15, 'Last15Days',
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 30, 'Last30Days'
)
)
) as DayFlag
You can not assign two values to the same row, since the check on 7 days are true for all the previous 7 dates, none of those will be checked in the 15 days statement. Consider having 3 flags, one per check, as I've done below:
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 7,
'True', 'False') as [Is last 7 days]
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 15,
'True', 'False') as [Is last 15 days]
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 30,
'True', 'False') as [Is last 30 days]
You can not assign two values to the same row, since the check on 7 days are true for all the previous 7 dates, none of those will be checked in the 15 days statement. Consider having 3 flags, one per check, as I've done below:
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 7,
'True', 'False') as [Is last 7 days]
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 15,
'True', 'False') as [Is last 15 days]
if(Date(Today(), 'YYYY-MM-DD') - Date(ORDER_DATE, 'YYYY-MM-DD') <= 30,
'True', 'False') as [Is last 30 days]