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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
tincholiver
Creator III
Creator III

NumWeek 1 newyear vs NumWeek 52 prevyear - how to compare?

Hi, I make a request:
answering some cases about comparisons between weeks I was a doubt.
the expression that seemed useful to me to make that kind of comparison was:
sum ({<NumWeek = {'> = $ (= max (NumWeek) -1) <$ (= max (NumWeek))'}>} Sales) for the previous week and,
sum ({<NumWeek = {'> = $ (= max (NumWeek))'}>} Sales) for the current week.
The question is how to solve the cases in which the year changes being compared to week 1 of the new year, with the 52 of the previous year.

1 Solution

Accepted Solutions
Vegar
MVP
MVP

I would add a week index to my calendar. The first week in the calendar is 1 when you start the next year you let the index be 53 (not 1)

With this week index field you may apply your current set expression logic.

You will of course keep your old week number (1-52) for presentation purposes.

View solution in original post

2 Replies
Vegar
MVP
MVP

I would add a week index to my calendar. The first week in the calendar is 1 when you start the next year you let the index be 53 (not 1)

With this week index field you may apply your current set expression logic.

You will of course keep your old week number (1-52) for presentation purposes.
tincholiver
Creator III
Creator III
Author

I understand, there seems to be no other method to solve this.
Thanks for your answer Vegar.