Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
MattOtoole
Partner - Contributor
Partner - Contributor

Week to date comparison

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! 

1 Reply
Kushal_Chawda

@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