Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Could anyone explain me this behavior? Today() = 19.02.2021
as @MayilVahanan mentionned, you're using the week() function with a wrong parameter
using 'DD MM YYYY' as second parameter is just as useful as using 'Mikael' as second parameter.
it expects the "first_week_day"
maybe qlik could/should return an empty or null or other error value, but at the basis, you're using a wrong parameter value...
if you want to store qvd's with week info, maybe use something like this:
date(weekstart(today()),'YYYY-MM-DD')
(that should remove the "W1, W53, issues that may appear around New Year...)
Hi @waszcma1
In week, we can't assign the date format. Generally, 2nd parameter of Week in Qlik takes the firstweekday.
FYR:
Hi, I know that syntax with week( today(),'DD-MM-YYYY') is wrong.
I have discover this in some apps handover to me and noticed that this is have a huge impact of indexing of qvd files where this week calculation is used in naming conventions. i.e.: store table into file_$(vWeek)_$(vYear).qvd(qvd);
The most odd thing is that
- this syntax week( today(),'DD-MM-YYYY') is not returning any error,
- it is returning different value for 15-17.02.2021. value is 8
- while on 18-19.02.2021 value is 9
I have discovered this when I have been asked to force reload and loading app referring to load * file_$(vWeek)_$(vYear).qvd(qvd) failed, I have debug variables and noticed that on Friday 19.02.2021
application was trying load the file with the name file_9_2021.qvd(qvd)
I think this is a Qlik Sense bug
week(today()) | = 15 | 16.04.2021
week(today()),'DDMMYYYY') | = 17 | 16.04.2021
week(today()-1,'DDMMYYYY') | = 17 | 15.04.2021
week(today()-2,'DDMMYYYY') | = 16 | 14.04.2021
week(today()-3,'DDMMYYYY') | = 16 | 13.04.2021
week(today()-4,'DDMMYYYY') | = 16 | 12.04.2021
Can someone who is more advanced than me explain me why the syntax is working but showing wrong week number?
The interesting behaviur is that week number is +2 for Friday and Thursday but +1 for Mon-Wed
Is it kind of managing BrokenWeeks ?
I have found this in one of my client and have no idea why it was used in such way for indexing week snapshots ,do you have any idea?
I think this is really bad approach as the manual reload on Friday or Thursday could casue the issue with generating snapshot file under wrong week number.
and some more examples:
Can anyone explain me why week() function is behaving like this with used 'DDMMYYYY' ?
it is becouse of global settings?
SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;
SET FirstMonthOfYear=1;
as @MayilVahanan mentionned, you're using the week() function with a wrong parameter
using 'DD MM YYYY' as second parameter is just as useful as using 'Mikael' as second parameter.
it expects the "first_week_day"
maybe qlik could/should return an empty or null or other error value, but at the basis, you're using a wrong parameter value...
if you want to store qvd's with week info, maybe use something like this:
date(weekstart(today()),'YYYY-MM-DD')
(that should remove the "W1, W53, issues that may appear around New Year...)
Thanks for putting more lights on this 🙂