Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to rename autocalendar fields

Hi,

I'm using the auto-generated calendar in Qlik Sense and want to rename the field names to make them more user-friendly.

The default names are [Date.autoCalendar.Year], [Date.autoCalendar.Month] etc, and I would like to rename them to just Year, Month etc.

I tried using RENAME FIELDS, but I doesn't seem to do anything.

Can anyone help?

Here's the script that generates the calendar and my attempt at renaming the fields:

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden');

DERIVE FIELDS FROM FIELDS [Date] USING [autoCalendar];

RENAME FIELDS

[Date.autoCalendar.Year] TO Year,

[Date.autoCalendar.Quarter] TO Quarter,

[Date.autoCalendar.Month] TO Month,

[Date.autoCalendar.YearQuarter] TO YearQuarter,

[Date.autoCalendar.YearMonth] TO YearMonth;

5 Replies
Not applicable
Author

Anyone?

MK9885
Master II
Master II

I don't know as it is using TAGGED in your script.

Use your own generated Master Calendar, you'll have more control on dates and/or can create new fields within the master script.

Not applicable
Author

Ok, I think I'll go ahead and create my own calendar script then. Thanks!

MK9885
Master II
Master II

You can use below link and it's attachment to create your own master. Ofcourse you'd have to change the dates to adjust your fact dates (vMax and vMin) in script.

Master Calendar Script

Vadimb
Partner - Contributor II
Partner - Contributor II

Hi,

did you find the solution for this issue?