Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
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;

4 Replies
Not applicable

Re: How to rename autocalendar fields

Anyone?

Khan_Mohammed
Not applicable

Re: How to rename autocalendar fields

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

Re: How to rename autocalendar fields

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

Khan_Mohammed
Not applicable

Re: How to rename autocalendar fields

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