Has someone played around with the new time calculation in 3.2? I tried to use it in an app I created and it stated No date fields detected. Does this only work with autocalendar, and If so how could I get it to work with an app I created?
I'm having the same issue. I definitely have date fields in the data model - and they have been formatted specifically with the Date function (in the data load script). I have tried adding the date field as a dimension as well, but that didn't work either. How is this new functionality actually supposed to work?
I'm not sure if this helps at all but, something I have been looking into as well.
If you have a group of fields that are related, or if fields carry information that can be broken up into smaller parts that are relevant when creating dimensions or measures, you can create field definitions that can be used to generate derived fields. One example is a date field, from which you can derive several attributes, such as year, month, week number, or day name. All these attributes can be calculated in a dimension expression using Qlik Sense date functions, but an alternative is to create a calendar definition that is common for all fields of date type. Field definitions are stored in the data load script.
You use the Declare statement to create a definition of the derived fields. This is where you define the different attributes of the field, in this case date related attributes.
DECLARE FIELD DEFINITION TAGGED '$date'
first_month_of_year = 1
Year($1) As Year Tagged '$year',
Month($1) as Month Tagged '$month',
Date($1) as Date Tagged ('$date', '$day'),
Week($1) as Week Tagged '$week',
Weekday($1) as Weekday Tagged '$weekday',
DayNumberOfYear($1, first_month_of_year) as DayNumberOfYear Tagged ('$numeric');
Qlik Sense is prepared to recognize derived date fields if you have created a calendar definition and mapped the fields like in the example here. They are available in the Date & time fields section of the Fields asset panel. You will also find all derived fields in the expression editor and when you create or edit dimensions.
One of the most important requirement/prerequisite to use this feature is to have date fields loaded through Data Manager and not through Qlik Sense Scripts as highlighted in the screenshot below.
This means that data should be loaded through Data Manager. Or, at least those data containing dates for which one wants to build measures or dimensions, must be loaded through Data Manager. Rest of the data or other script code can be added to other sections of Data Load Editor.
Also, data loaded through Data Manager will appear in script as shown in below screenshot.