Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
arome
Contributor II
Contributor II

Week Function Not Working?

Hello!!

I have three fields: Year, Month, Week (of the month, 1-5) and am trying to use Qliks week and date functions to produce the Wednesday date of each week. The approach I have taken works for most cases, but for some reason the week() function in qlik is not always producing the week number I am expecting. 

For example, for 2021, September, Week 1, I would expect September 1st, but Qlik is booting the date back one week to September 8th. This is because the Week() function returns week #36 for date 9/1/2021, even though this is the 35th week (/wednesday) of the year (see https://calcudater.com/wednesdays-in-2021). I have tried using the various arguments available for MakeDate, Week, and MakeWeekDate, but nothing is fixing this problem. Please Help!!!!!!! 

 

date expression:  MakeWeekDate(PricingYear, Week(MakeDate(PricingYear, PricingMonth), 2) + PricingWeek-1, 2)

       (2=wednesday)

Example Table: (first column is a concatenation of the year/month/week values)

arome_0-1645812492615.png

 

Labels (2)
4 Replies
tstach
Contributor
Contributor

Great question! I'm not sure.

MarcoWedel

arome
Contributor II
Contributor II
Author

Thank you for your response! Unfortunately, changing the broken weeks value has no effect on the result.

chris_djih
Creator III
Creator III

it is because of your week definition: "Week(MakeDate(PricingYear, PricingMonth), 2)"
You say to qlik that the week should start on wednesdays. Set this to 0(monday) or 6(sunday), depending what is the official weekstart in your region.

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.