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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vajid4525
Contributor III
Contributor III

Weekyear function

Hi Team,

For the below examples please let me know whether my understanding on the weekyear function is right or not

weekyear( '1997-12-30' ), weekyear( '1999-01-02' )

if  SET FirstWeekDay=6;
SET BrokenWeeks=0;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;

Weekyear calculates the week number of a given date and if that week number is in the bridge between two years it will return the year which has the maximum % of that week number. if it's not in bridge it will return the same year itself.

Thank you

Labels (1)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

This wil help you 

For the date '1997-12-30', the week number is 1, and since this week is entirely within the year 1997, the Weekyear function will return 1997.

 

For the date '1999-01-02', the week number is 1 as well, but this week overlaps two years: 1998 and 1999. Since the majority of the days in this week fall in 1999, the Weekyear function will return 1999.

 

Go through below link for more info 

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFunc...().

 

View solution in original post

2 Replies
Chanty4u
MVP
MVP

This wil help you 

For the date '1997-12-30', the week number is 1, and since this week is entirely within the year 1997, the Weekyear function will return 1997.

 

For the date '1999-01-02', the week number is 1 as well, but this week overlaps two years: 1998 and 1999. Since the majority of the days in this week fall in 1999, the Weekyear function will return 1999.

 

Go through below link for more info 

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFunc...().

 

vajid4525
Contributor III
Contributor III
Author

For the date '1997-12-30', the week number is 1, and since this week is entirely within the year 1997, the Weekyear function will return 1997

1997-12-30 week number is 53. But majority is in 1997 itself

vajid4525_0-1687483093821.png