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: 
aaron
Contributor
Contributor

Qlik generated date fields

The following code snippet is auto-generated for date fields:

[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
...

Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),
...

(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
Week(Today())-Week($1) AS [WeekRelNo] ;

However, the results do not make sense.  How can Week (=W01) be consistent and Weeks ago jump from 60 to 112? Is there documentation that explains what is happening here?

aaron_0-1614359480398.png

 

 

1 Solution

Accepted Solutions
aaron
Contributor
Contributor
Author

@ArnadoSandoval 

Yes. I see that. Thank you.

Your conclusion is correct and I was able to easily fix it--although you did have, what I believe, is an honest mistake, "...two calendar years, 2019 and 2019..." should be 2019 and 2020.

Please let me know where I can find documentation on variables, functions, keywords used in the  data load editor.

 

View solution in original post

2 Replies
ArnadoSandoval
Specialist II
Specialist II

Hi @aaron 

The data is consistent, you missed a property in the data, causing your confusion, by looking at you screenshot:

AutoCalendar-Conf-01.png

You are mixing Res Week between two calendar years, 2019 and 2019; the field Res Week the week number within the transaction's year, so obviously the weeks ago for the first week of the previous year is about 112 weeks, and these fields are calculated from today's date, I build a similar application here, getting the results shown below:

AutoCalendar-Conf-02.png

As you can see, the figures on those fields are  off by 1 compared with your screenshot, except for the Res Week, which is the week number for the transaction's year.

Hope this helps,

 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
aaron
Contributor
Contributor
Author

@ArnadoSandoval 

Yes. I see that. Thank you.

Your conclusion is correct and I was able to easily fix it--although you did have, what I believe, is an honest mistake, "...two calendar years, 2019 and 2019..." should be 2019 and 2020.

Please let me know where I can find documentation on variables, functions, keywords used in the  data load editor.

 

View solution in original post