Does anyone know how to do 2 formulas on search results that will do this year to date sales and last year to date (separate columns). I have searches similar to this that cover an entire month, but am having trouble figuring out how to do year to date.
c
Chloë
01/13/2021, 8:18 PM
For this YTD, you can do something like this: CASE WHEN {trandate} BETWEEN to_date('1/1/2021', 'MM/DD/YYYY') AND to_date({today}) THEN {amount} ELSE 0 END
Chloë
01/13/2021, 8:19 PM
For last YTD: CASE WHEN {trandate} BETWEEN to_date('1/1/2020', 'MM/DD/YYYY') AND to_date(to_char({today},'YYYY')-1||to_char({today},'MMDD'),'YYYYMMDD') THEN {amount} ELSE 0 END
✅ 2
Chloë
01/13/2021, 8:21 PM
You can replace the {trandate} field with whatever date field you need, and the {amount} field with whatever you need to be returned.