<?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>topic Re: AutoCalendar not working properly with if-statements &amp;amp; set-analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768895#M59474</link>
    <description>&lt;P&gt;Thank you for the elaborate answer, I understand the issue perfectly now. What I don't understand, is why Qlik would use this dual function in their autocalendar script, as the one I used was generated by the data manager. Very confusing...&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 09:44:36 GMT</pubDate>
    <dc:creator>bartdeboed</dc:creator>
    <dc:date>2020-12-16T09:44:36Z</dc:date>
    <item>
      <title>AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768307#M59436</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm having some trouble with the AutoCalendar function when using it within if-statements and set-analysis. While searching this issue, I've found a &lt;A href="https://community.qlik.com/t5/Qlik-Sense-App-Development/Derived-fields-not-working-in-Set-Analysis/td-p/794790" target="_self"&gt;post from 2015&lt;/A&gt; that indicated it was a bug. However, I can't find whether this bug has been resolved or not. The post has been 'solved', but the solution just says that it is reported as a bug.&lt;/P&gt;&lt;P&gt;What happens is that if I use an AutoCalendar field within a set-analysis expression OR in an if-statement, it doesn't work.&lt;/P&gt;&lt;P&gt;For example: Count({&amp;lt;[Datefield.autoCalendar.Year]={"&amp;gt;2016"} &amp;gt;} ID) does &lt;U&gt;not work&lt;/U&gt;, while if I load year(Datefield) as Yearfield, then the following &lt;U&gt;does work&lt;/U&gt;;&amp;nbsp;Count({&amp;lt;Yearfield={"&amp;gt;2016"} &amp;gt;} ID)&lt;/P&gt;&lt;P&gt;Another example is when I make a linechart and add the dimension:&amp;nbsp;if([Datefield.autoCalendar.Year]&amp;gt;2016,Datefield.autoCalendar.Year), it does not work. While, If(year(Datefield)&amp;gt;2016,Datefield.autoCalendar.Year) does work.&lt;/P&gt;&lt;P&gt;This is the script I use in the load script for AutoCalendar:&lt;BR /&gt;[autoCalendar]:&lt;BR /&gt;DECLARE FIELD DEFINITION Tagged ('$date')&lt;BR /&gt;FIELDS&lt;BR /&gt;Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year')&lt;/P&gt;&lt;P&gt;Can anyone tell me if I'm doing it wrong or whether it is still a bug?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:57:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768307#M59436</guid>
      <dc:creator>bartdeboed</dc:creator>
      <dc:date>2024-11-16T00:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768568#M59460</link>
      <description>&lt;P&gt;This:&amp;nbsp;&lt;SPAN&gt;Dual(Year($1), YearStart($1)) AS [Year]&lt;/SPAN&gt;&amp;nbsp;isn't a year else a (formatted) timestamp because yearstart() returned a timestamp - and this is not a bug. Therefore just use year(Datefield) if you want to have a year-field.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 11:13:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768568#M59460</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-12-15T11:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768794#M59470</link>
      <description>&lt;P&gt;As &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;is saying, your year field is holding a dual value where the numeric part is a date and the text part is the four digit year. This is similar to how the YearName() function works.&lt;/P&gt;&lt;P&gt;Applying set analysis on dual values can be a bit tricky because you need to know if you are to consider the numeric or string value in your set modifier.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do a comparing&amp;nbsp; set analysis on such a field you need to compare with the date value not the four digit year. (Assuming you date format is YYYY-MM-DD)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;[Datefield.autoCalendar.Year]={"&amp;gt;'2016-01-01' "} &amp;gt;} ID)&lt;/P&gt;&lt;P&gt;Observe that the expression below will also work as you are not evaluating the numeric but comparing the string, but here you get the count for a single year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;[Datefield.autoCalendar.Year]={'2016'} &amp;gt;} ID)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 05:56:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768794#M59470</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-12-16T05:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768895#M59474</link>
      <description>&lt;P&gt;Thank you for the elaborate answer, I understand the issue perfectly now. What I don't understand, is why Qlik would use this dual function in their autocalendar script, as the one I used was generated by the data manager. Very confusing...&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 09:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768895#M59474</guid>
      <dc:creator>bartdeboed</dc:creator>
      <dc:date>2020-12-16T09:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768924#M59476</link>
      <description>&lt;P&gt;It guess it is a&amp;nbsp; matter of taste,&amp;nbsp; I personally tend not to use duals() in Year fields, but I do use dual values when working on&amp;nbsp; year-month or year-week fields, often generated by monthname(DateKey) or weekname(), and then the set modifiers have fit those fields in the same manner as you Year field. I have however found the dual in year to be handy in some scenarious when working with both calendar year and fiscal year-calendars.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 10:29:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1768924#M59476</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-12-16T10:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1780826#M60754</link>
      <description>&lt;P&gt;Hi Vegar,&lt;/P&gt;&lt;P&gt;If you remove the dual, it is no longer possible to have a continuous scale automatically. If I change the x-axis to manual and select 'continuous', the years turn into 2,01k and 2,02k.&lt;/P&gt;&lt;P&gt;The continuous scale is something we value a lot. Is there any way to fix this while maintaining the possibility to use set-analysis as described above (year instead of date)?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 11:11:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1780826#M60754</guid>
      <dc:creator>bartdeboed</dc:creator>
      <dc:date>2021-02-08T11:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCalendar not working properly with if-statements &amp; set-analysis</title>
      <link>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1780849#M60756</link>
      <description>&lt;P&gt;why not create a second Year field called &lt;STRONG&gt;YearSA &lt;/STRONG&gt;for example, without the dual ?&lt;/P&gt;&lt;P&gt;This will allow you use one field for continuous scale and the other for Set analysis&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 12:33:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/AutoCalendar-not-working-properly-with-if-statements-amp-set/m-p/1780849#M60756</guid>
      <dc:creator>bismart</dc:creator>
      <dc:date>2021-02-08T12:33:14Z</dc:date>
    </item>
  </channel>
</rss>

