Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
waszcma1
Creator
Creator

Week return different values

Could anyone explain me this behavior? Today() = 19.02.2021

waszcma1_0-1613727771157.png

 

Labels (1)
4 Replies
MayilVahanan

Hi @waszcma1 

In week, we can't assign the date format. Generally, 2nd parameter of Week in Qlik takes the firstweekday.

FYR:

https://help.qlik.com/en-US/sense/November2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTim...

Thanks & Regards,
Mayil Vahanan R
waszcma1
Creator
Creator
Author

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 




waszcma1
Creator
Creator
Author



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. 

waszcma1
Creator
Creator
Author

and some more examples:
Week issue.PNG