Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik Sense - Date & Time

I'm trying to use the new date & time feature in QS 1.1.0.

Issue 1: The Load is failing & I'm getting a script line error. What am I doing wrong ? Here's what I am using

Calendar:

Declare Field Definition Tagged '$Date'

  Parameters

    first_month_of_year = 1

    Fields

        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'

    Groups

        Year, Month, Date type Collection as YearMonthDate;

Issue 2: Is there an equivalent for Quarter ?

Thanks. Rahul

2 Replies
Gysbert_Wassenaar

Try 'Q' & ceil*(Month($1)/3) as Quarter Tagged '$quarter'


Don't forget to add a DERIVE statement after defining the fields. See the help for details:

http://help.qlik.com/sense/en-US/online/#../Subsystems/Hub/Content/Scripting/DerivedFields.htm


talk is cheap, supply exceeds demand
Michael_Tarallo
Employee
Employee

Hi Rahul,

Please see my replies in this thread for more information:

Re: Derived calendar groups doesn't show up

In regards to the "Groups" syntax - that is reserved for a future feature - where it has been implemented in the back-end, but not yet exposed in the UI. There was a mistake adding that in the sample code in the documentation, and it is being updated. The Groups feature will be available in a  future release - where it will automatically create the collection and cyclic groups for those specified fields.

Calendar:

DECLARE FIELD DEFINITION TAGGED '$date'

   Parameters

      first_month_of_year = 1

   Fields

      Year($1) As Year Tagged '$year',

      Month($1) as Month Tagged '$month',

      MonthName($1) as MonthName Tagged '$monthname',

      Date($1) as Date Tagged ('$date', '$day'),

      Week($1) as Week Tagged '$week',

   WeekName($1) as WeekName Tagged '$weekname',     

      Weekday($1) as Weekday Tagged '$weekday',

      DayNumberOfYear($1, first_month_of_year) as DayNumberOfYear,

   'Q' & ceil*(Month($1)/3) as Quarter Tagged '$quarter'

 

DERIVE FIELDS FROM FIELDS "Claim Creation Date" USING Calendar;

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik