<?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: Using Year function in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097960#M364635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=sum({&amp;lt;Year={'=Year(GetFieldSelections([Current Hire Date]))'}&amp;gt;}HeadCount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jun 2016 07:13:35 GMT</pubDate>
    <dc:creator>sasiparupudi1</dc:creator>
    <dc:date>2016-06-01T07:13:35Z</dc:date>
    <item>
      <title>Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097956#M364631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field called [Current Hire Date] in my model which is a date. I have a list box on my UI which just shows the Hire Year using Year(Current Hire Date) formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have data sources for Dec 2015 and every month so far in 2016. What I need is to build out a chart that shows the number of resources who joined in 2015 or 2016 AS PER the data in that year. In other words, if the user selects 2015 as the Hire Year, I need to display the count of resources who joined in 2015 as of Dec 2015 and not as of today (since some people may have left since 2015).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to do something like:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year=Getfieldselections(Year(Current Hire Date)Headcount), but this doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to keep this calculation on the front end, so I can't add Year(Current Hire Date) as a dimension in my script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any sugestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2016 15:51:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097956#M364631</guid>
      <dc:creator>nikita42</dc:creator>
      <dc:date>2016-05-31T15:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097957#M364632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Edit: I was missing a parenthesis in the Year() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Nikita,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14647126903437563" jivemacro_uid="_14647126903437563" modifiedtitle="true"&gt;
&lt;P&gt;Sum({&amp;lt;[Current Hire Date] = {"&amp;gt;=$(=MakeDate(Year(GetFieldSelections([Current Hire Date])), 12, 31))"}&amp;gt;} Headcount)&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't test this so you may need to tweak it a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2016 16:45:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097957#M364632</guid>
      <dc:creator>sinanozdemir</dc:creator>
      <dc:date>2016-05-31T16:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097958#M364633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't need to use the MakeDate function. I need something more like - GetFieldSelections(Year(Current HIre Date)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's the bit that's throwing up errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2016 16:57:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097958#M364633</guid>
      <dc:creator>nikita42</dc:creator>
      <dc:date>2016-05-31T16:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097959#M364634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nikita,&lt;/P&gt;&lt;P&gt;Use year before GetFieldSelections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Year(GetFieldSelections(Current HIre Date))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 06:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097959#M364634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-01T06:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097960#M364635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=sum({&amp;lt;Year={'=Year(GetFieldSelections([Current Hire Date]))'}&amp;gt;}HeadCount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 07:13:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097960#M364635</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2016-06-01T07:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097961#M364636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year = {"$(=Year(Getfieldselections([Current Hire Date])))"}&amp;gt;} Headcount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it work only for one selected date - otherwise you need a different approach to getfieldselections - maybe a max(date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 07:14:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097961#M364636</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-06-01T07:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097962#M364637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to use the Year function in this way:&lt;/P&gt;&lt;P&gt;{&amp;lt;Year(Current Hire date)=GetFieldSelection(Year)&amp;gt;}?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 08:40:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097962#M364637</guid>
      <dc:creator>nikita42</dc:creator>
      <dc:date>2016-06-01T08:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097963#M364638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, this isn't possible - the left part of the set analysis condition must be a field. But you could easily create such period-field within the script, see also: &lt;A href="https://community.qlik.com/docs/DOC-8843"&gt;How to use - Master-Calendar and Date-Values&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 09:21:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097963#M364638</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-06-01T09:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097964#M364639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B:&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;Date(Date#([Current Hire Date],'MMM YYYY')) as [Current Hire Date],&lt;/P&gt;&lt;P&gt;Headcount&lt;/P&gt;&lt;P&gt; Inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Current Hire Date,Headcount&lt;/P&gt;&lt;P&gt;Sep 2015,40&lt;/P&gt;&lt;P&gt;Nov 2015,10&lt;/P&gt;&lt;P&gt;Dec 2015,30&lt;/P&gt;&lt;P&gt;Jan 2016,20&lt;/P&gt;&lt;P&gt;Feb 2016,6&lt;/P&gt;&lt;P&gt;Mar 2016,4&lt;/P&gt;&lt;P&gt;Apr 2016,22&lt;/P&gt;&lt;P&gt;May 2016,44&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;Filter : list box&amp;nbsp; with the expression&lt;/P&gt;&lt;P&gt;=year([Current Hire Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text Box With the following expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;[Current Hire Date]={'=Year(Min([Current Hire Date]))=Year(Max([Current Hire Date]))'}&amp;gt;}Headcount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 09:48:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097964#M364639</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2016-06-01T09:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097965#M364640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was afraid of that! In that case, I'll need this expression to look something like this:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Current Hire Date]={&amp;gt;=YearStart(GetFieldSelections(Year)&amp;lt;=YearEnd(GetFieldSelections(Year))}&amp;gt;}Headcount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It'd be great if you could also explain a bit on the use of brackets and quotation marks in this expression, because that's where I keep going wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 10:03:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097965#M364640</guid>
      <dc:creator>nikita42</dc:creator>
      <dc:date>2016-06-01T10:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using Year function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097966#M364641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes there are some syntax rules but they are not so complicated like it looked at the beginning. Here you will find a very good explantion with many examples: &lt;A href="https://community.qlik.com/docs/DOC-4951"&gt;Set Analysis: syntaxes, examples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your expression, try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Current Hire Date]={"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;=$(=date(floor(YearStart(GetFieldSelections([Current Hire Date])))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;=$(=date(floor(YearEnd(GetFieldSelections([Current Hire Date])))))"}&amp;gt;}Headcount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason are that you could get a yearstart from a year esle you will need a date and yearstart returned a timestamp which needs to be truncated per floor() and then it needs to be formatted again - then by set analysis must not only the values fit also the formatting must be the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 10:41:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Year-function-in-set-analysis/m-p/1097966#M364641</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-06-01T10:41:54Z</dc:date>
    </item>
  </channel>
</rss>

