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');
The next step is to use the Derive statement to map existing data fields to the calendar. This will create the derived fields. You can do this in three ways:
- Map specific fields by field name.DERIVE FIELDS FROM FIELDS OrderDate,ShippingDate USING Calendar;
- Map all fields with one or more specific field tags.DERIVE FIELDS FROM EXPLICIT TAGS '$date' USING Calendar;
- Map all fields that are tagged with one of the tags of the field definition ($date in the example above).DERIVE FIELDS FROM IMPLICIT TAG USING Calendar;
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.
Hope that helps !