<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to create on your own an Autocalendar (Derived fields) in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/ta-p/1716542</link>
    <description>&lt;P&gt;&lt;EM&gt;The information and script in this article are provided as is. For further customization and assistance, engage with our active &lt;A href="https://community.qlik.com/t5/QlikView-App-Dev/bd-p/qlikview-app-development" target="_blank" rel="noopener"&gt;QlikView&lt;/A&gt; or &lt;A href="https://community.qlik.com/t5/Qlik-Sense-App-Development/bd-p/qlik-sense-app-development" target="_blank" rel="noopener"&gt;Qlik Sense&lt;/A&gt; app-building boards.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 &lt;SPAN class="PrimaryGenericName"&gt;Qlik Sense&lt;/SPAN&gt; 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.&lt;/P&gt;
&lt;P&gt;Note in case that you need to change the format / to customize the date you need to do it from the script, and most probably drill down to all levels, depending of course the object and what you want to accomplish.&lt;/P&gt;
&lt;P&gt;Here is such an example of an autocalendar that can be used in any case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),
Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),
Dual(Year($1)&amp;amp;'-Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),
Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
Month($1) AS [Month] Tagged ('$month', '$cyclic'),
Dual(Year($1)&amp;amp;'-'&amp;amp;Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),
Dual('W'&amp;amp;Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),
Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),
Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),
If (DayNumberOfYear($1) &amp;lt;= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
Year(Today())-Year($1) AS [YearsAgo] ,
If (DayNumberOfQuarter($1) &amp;lt;= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,
Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,
If(Day($1)&amp;lt;=Day(Today()),1,0) AS [InMTD] ,
12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,
Month(Today())-Month($1) AS [MonthRelNo] ,
If(WeekDay($1)&amp;lt;=WeekDay(Today()),1,0) AS [InWTD] ,
(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
Week(Today())-Week($1) AS [WeekRelNo] ;

DERIVE FIELDS FROM FIELDS [Date] USING [autoCalendar] ;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2022 19:23:50 GMT</pubDate>
    <dc:creator>Sonja_Bauernfeind</dc:creator>
    <dc:date>2022-05-10T19:23:50Z</dc:date>
    <item>
      <title>How to create on your own an Autocalendar (Derived fields)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/ta-p/1716542</link>
      <description>&lt;P&gt;&lt;EM&gt;The information and script in this article are provided as is. For further customization and assistance, engage with our active &lt;A href="https://community.qlik.com/t5/QlikView-App-Dev/bd-p/qlikview-app-development" target="_blank" rel="noopener"&gt;QlikView&lt;/A&gt; or &lt;A href="https://community.qlik.com/t5/Qlik-Sense-App-Development/bd-p/qlik-sense-app-development" target="_blank" rel="noopener"&gt;Qlik Sense&lt;/A&gt; app-building boards.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 &lt;SPAN class="PrimaryGenericName"&gt;Qlik Sense&lt;/SPAN&gt; 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.&lt;/P&gt;
&lt;P&gt;Note in case that you need to change the format / to customize the date you need to do it from the script, and most probably drill down to all levels, depending of course the object and what you want to accomplish.&lt;/P&gt;
&lt;P&gt;Here is such an example of an autocalendar that can be used in any case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),
Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),
Dual(Year($1)&amp;amp;'-Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),
Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
Month($1) AS [Month] Tagged ('$month', '$cyclic'),
Dual(Year($1)&amp;amp;'-'&amp;amp;Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),
Dual('W'&amp;amp;Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),
Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),
Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),
If (DayNumberOfYear($1) &amp;lt;= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
Year(Today())-Year($1) AS [YearsAgo] ,
If (DayNumberOfQuarter($1) &amp;lt;= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,
Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,
If(Day($1)&amp;lt;=Day(Today()),1,0) AS [InMTD] ,
12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,
Month(Today())-Month($1) AS [MonthRelNo] ,
If(WeekDay($1)&amp;lt;=WeekDay(Today()),1,0) AS [InWTD] ,
(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
Week(Today())-Week($1) AS [WeekRelNo] ;

DERIVE FIELDS FROM FIELDS [Date] USING [autoCalendar] ;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 19:23:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/ta-p/1716542</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2022-05-10T19:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create on your own an Autocalendar (Derived fields)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/1791605#M1955</link>
      <description>&lt;P&gt;Hello , how I can make&amp;nbsp;half year derived in autocalendar ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I make this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dual('H'&amp;amp;Num(Ceil(Num(Month($1))/6)),Num(Ceil(NUM(Month($1))/6),00)) AS [Half] Tagged ('$half', '$cyclic'),&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'HY' &amp;amp; ceil(month(date#(($1),'MMM YYYY'))/6) as HalfYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The derivation was created, but in the graph it does not look like the year next to it is only half.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Calendar]:&lt;BR /&gt;DECLARE FIELD DEFINITION Tagged ('$date')&lt;BR /&gt;FIELDS&lt;BR /&gt;Dual(Year($1), YearStart($1)) AS [Ano] Tagged ('$axis', '$year'),&lt;BR /&gt;//Dual('H'&amp;amp;Num(Ceil(Num(Month($1))/6)),Num(Ceil(NUM(Month($1))/6),00)) AS [Half] Tagged ('$half', '$cyclic'),&lt;BR /&gt;//'HY' &amp;amp; ceil(month(date#(($1),'MMM YYYY'))/6) as HalfYear,&lt;BR /&gt;ceil(Month($1)/6)&amp;amp;'º Sem' as [Semestre],&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Trimestre] Tagged ('$quarter', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [Ano Trimestre] Tagged ('$yearquarter', '$qualified'),&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),&lt;BR /&gt;//Dual('H'&amp;amp;Num(Ceil(Num(Month($1))/6)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),&lt;BR /&gt;Month($1) AS [Mês] Tagged ('$month', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-'&amp;amp;Month($1), monthstart($1)) AS [Ano/Mês] Tagged ('$axis', '$yearmonth', '$qualified'),&lt;BR /&gt;Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),&lt;BR /&gt;Dual('W'&amp;amp;Num(Week($1),00), Num(Week($1),00)) AS [Semana] Tagged ('$weeknumber', '$cyclic'),&lt;BR /&gt;Date(Floor($1)) AS [DATA] Tagged ('$axis', '$date', '$qualified'),&lt;BR /&gt;Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),&lt;BR /&gt;weekday($1) as [Dia da Semana],&lt;BR /&gt;Week(Today())-Week($1) AS [WeekRelNo] ;&lt;/P&gt;&lt;P&gt;DERIVE FIELDS FROM FIELDS [C5_EMISSAO] USING [Calendar] ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RochaPedro_0-1615848623895.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51196i40A03A033F584B2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="RochaPedro_0-1615848623895.png" alt="RochaPedro_0-1615848623895.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Its ok!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In half year:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RochaPedro_1-1615848680994.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51197i86761801BFDA0DF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RochaPedro_1-1615848680994.png" alt="RochaPedro_1-1615848680994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it does not look like the year next to it is only half.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 22:56:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/1791605#M1955</guid>
      <dc:creator>RochaPedro</dc:creator>
      <dc:date>2021-03-15T22:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create on your own an Autocalendar (Derived fields)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/1791675#M1957</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/77726"&gt;@RochaPedro&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;I'd recommend taking this over to the respective board for App building (Qlikview or Qlik Sense, depending on what you are working with). You'll be able to get the right eyes on your query there!&lt;/P&gt;
&lt;P&gt;I grabbed you the links to the boards:&amp;nbsp;&amp;nbsp;&lt;A href="https://community.qlik.com/t5/QlikView-App-Dev/bd-p/qlikview-app-development" target="_blank" rel="noopener"&gt;QlikView&lt;/A&gt; or &lt;A href="https://community.qlik.com/t5/Qlik-Sense-App-Development/bd-p/qlik-sense-app-development" target="_blank" rel="noopener"&gt;Qlik Sense&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 07:26:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/1791675#M1957</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2021-03-16T07:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create on your own an Autocalendar (Derived fields)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/2472490#M14315</link>
      <description>&lt;P&gt;[autoCalendar]: &lt;BR /&gt;DECLARE FIELD DEFINITION TAGGED ('$timestamp')&lt;BR /&gt;FIELDS&lt;BR /&gt;DAYNAME($1) AS [date],&lt;BR /&gt;YEAR($1) AS [year],&lt;BR /&gt;MONTH($1) AS [month],&lt;BR /&gt;MONTHNAME($1) AS [month_name],&lt;BR /&gt;CEIL(MONTH($1) / 3) AS [quarter],&lt;BR /&gt;CEIL(MONTH($1) / 6) AS [semester],&lt;BR /&gt;DUAL(YEAR($1) &amp;amp; '/' &amp;amp; CEIL(MONTH($1) / 3), MONTHSNAME(3, $1)) AS [quarter_name],&lt;BR /&gt;DUAL(YEAR($1) &amp;amp; '/' &amp;amp; CEIL(MONTH($1) / 6), MONTHSNAME(6, $1)) AS [semester_name],&lt;BR /&gt;WEEKDAY($1) AS [weekday],&lt;BR /&gt;DAY($1) AS [day],&lt;BR /&gt;HOUR($1) AS [hour],&lt;BR /&gt;MINUTE($1) AS [minute],&lt;BR /&gt;TIME($1) AS [time],&lt;BR /&gt;WEEK($1) AS [week_of_year],&lt;BR /&gt;WEEKNAME($1) AS [week_year],&lt;BR /&gt;FLOOR((WEEKNAME($1) - WEEKNAME(MONTHSTART($1), -1)) / 7) AS [week_of_month],&lt;BR /&gt;DUAL(&lt;BR /&gt;MONTH($1) &amp;amp; '/' &amp;amp; FLOOR((WEEKNAME($1) - WEEKNAME(MONTHSTART($1), -1)) / 7),&lt;BR /&gt;NUM(NUM(MONTH($1)) &amp;amp; FLOOR((WEEKNAME($1) - WEEKNAME(MONTHSTART($1), -1)) / 7))&lt;BR /&gt;) AS [week_month],&lt;BR /&gt;DUAL(&lt;BR /&gt;MONTHNAME($1) &amp;amp; '/' &amp;amp; FLOOR((WEEKNAME($1) - WEEKNAME(MONTHSTART($1), -1)) / 7), &lt;BR /&gt;IF(MONTHNAME(WEEKSTART($1)) = MONTHNAME($1), WEEKSTART($1), MONTHSTART($1))&lt;BR /&gt;) AS [week_month_name]&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 18:49:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/2472490#M14315</guid>
      <dc:creator>luciano_pw</dc:creator>
      <dc:date>2024-07-23T18:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create on your own an Autocalendar (Derived fields)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/2478531#M14495</link>
      <description>&lt;P&gt;Why doesn't this calendar table show up in the data model viewer in QS ?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 18:43:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-create-on-your-own-an-Autocalendar-Derived-fields/tac-p/2478531#M14495</guid>
      <dc:creator>GerryCast</dc:creator>
      <dc:date>2024-08-28T18:43:37Z</dc:date>
    </item>
  </channel>
</rss>

