Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Week number past 52

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.

3 Replies
Not applicable

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.

jpenuliar
Partner - Specialist III
Partner - Specialist III

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.

agomes1971
Specialist II
Specialist II

Hi,

have you looked at this...

Redefining the Week Numbers

Regards

André Gomes