Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Idea required - week between years


Hi all,

I am just trying to think of an idea to capture that "week_between_the_years" that we had this/last year and that we're having again next/this year:

- A part of the week is in Dec. of one year, in week 52

- A part of the week is in Jan. of the following year, in week 1

I just thought I'd share the way I have devised of doing this, maybe someone can come up with a better one.

I have so far devised a way of capturing that case, but I realize that it does only half the job:

- By using year(weekstart(today(), -1)) and week(weekstart(today, -1)), I can determine that the start of that week is not in this year, but in the last and that the nr. of that week is not (2-1), but 52.

<=> However, if I build that into a set_expression, because of the year_selection, it captures only those days which were effectively in the same year and week as the start of the week - so, taking last/this year as an example, it would have captured only Mo and Tue.

=> Easy enough, the remaining days could be captured by using year(weekend(today(), -1)) and week(weekend(today, -1)).

=> That would make the set_expression really complex as you'd have to actually use two different ones and build them into an

      IF_construct querying first if weekstart is in a different year than weekend.

=> This is, however, the best I can think of.

If someone has a better idea, please share it.

Best regards,

DataNibbler

0 Replies