Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, since the new year began I would need to show the % change between week 53 (in a new year) and week 52. However the week number resets to 0 for a new year. Is there a way to make the week number continue past week 52? My formula for % change is like this:
count({<DAY =,MONTH =,WEEK =,WEEKNUMBER ={$(=max(WEEKNUMBER ))}>} Sales)-
count({<DAY =,MONTH =,WEEK =,WEEKNUMBER ={$(=max(WEEKNUMBER )-1)}>} Sales))
Thanks.
Write an if condition.
Set vPrevWeekNumber= if(max(WEEKNUMBER)=1,52,max(WEEKNUMBER)-1);
count({<DAY =,MONTH =,WEEK =,WEEKNUMBER ={$(=max(WEEKNUMBER ))}>} Sales)
-
count({<DAY =,MONTH =,WEEK =,WEEKNUMBER ={$(=vPrevWeekNumber)}>} Sales))
If its getting restricted by year, add year=year-1 in set analysis condition.
I had the same issue earlier last week,
In the below i have current week as vWeek_0, previous week as vWeek_1.
You will also have additional date field of WeekName() format, lets call that field "fld_YearWeek".
I assumed Week starts on Monday(which is today, 2015/01/05) and to go previous week is -7 days:
LET vWeek_0 =Weekname(Date( Today() - 0 , 'YYYY/MM/DD')) , this gives 2015/02
Week_1 =Weekname(Date( Today() - 7 , 'YYYY/MM/DD')) , this gives 2015/01...
in the expression:
Count({<fld_YearWeek={'$(=(vWeek_0))''} >}Sales)
you can expand from there.