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: 
Fabien
Contributor III
Contributor III

Max week picking up week 52 of previous year

Hi all,

I am trying to get a Count measure working that would count the distinct Unique refs for the max year/week that is currently in the system, however when i type in my expression, it's taking the correct year but not the correct week.

week(Date_request) should return Week 12 for 2020

Appreciate some feedback.

Cheers,QlikSense.png

count({$<week_request={"$(=max(year(date_request))&'/'&max(week(date_request)))"}>} distinct(Unique_search_ref))

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Does this solve your issue?

count({$<week_request={"$(=max(year(date_request))&'/'&week(max(date_request)))"}>} distinct(Unique_search_ref))

I switched place between week () and max ().

View solution in original post

4 Replies
Vegar
MVP
MVP

Does this solve your issue?

count({$<week_request={"$(=max(year(date_request))&'/'&week(max(date_request)))"}>} distinct(Unique_search_ref))

I switched place between week () and max ().

Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi guys

Just my 2 cents... when faced with questions regarding weeks and years I often use the weekname function. I don't see it used often, but I find it super useful.

Regards,

Mauritz

Vegar
MVP
MVP

You could also consider using weekyear over week to handle correct year around new years.

Vegar
MVP
MVP

I second your 2 cents @Mauritz_SA , but make sure that the field used for comparing is also formated as WeekName.