Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I'm trying to compare week on week performance, by comparing week to date - so for example Monday/Tuesday/Wednesday of this weeek versus Monday/Tuesday/Wednesday of last week.
I'm able to compare the Monday vs Monday, Tuesday vs Tuesday etc but not total up the week as it goes through as a whole.
Had been using this sum ({$< date = {'$(=date(today(0)-7))'}>} sales) as a day this week vs day last.
Any ideas how to have this run from Monday - Sunday and compare Week on Week.
Thanks!
@MattOtoole There are couple of ways you can do it. Below way is to create the Flags in script. Last parameter in function InWeekToDate is 0 which means first day of the week is Monday(0) . You can change it according to your requirement
InWeekToDate(Date,today(),0,0) *-1 as CurrentWeekToDate,
InWeekToDate(Date,today(),-1,0)*-1 as PreviousWeekToDate
Then you can use the below measure to compare
=sum({<CurrentWeekToDate={1}>}Sales)
=sum({<PreviousWeekToDate={1}>}Sales)
Another way is to use below measures. Last parameter in function WeekStart & WeekEnd is 0 which means first day of the week is Monday(0) . You can change it according to your requirement
=sum({<Date ={">=$(=date(weekstart(today(),0,0)))<=$(=date(weekend(today(),0,0)))"}>}Sales) // current week
=sum({<Date ={">=$(=date(weekstart(today(),-1,0)))<=$(=date(weekend(today(),-1,0)))"}>}Sales) // Previous week