<?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 Set Analysis issue... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-issue/m-p/507652#M189792</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'm having some issues with set analysis in a chart I'm trying to create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My fact data has a field SERVICEDATE. I am trying to create a chart that plots values for 2012, 2013 and 2014 alongside each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using expressions such as: =sum({$&amp;lt;SERVICEDATE={'*/2012'}&amp;gt;}SALESPRICEEUR) is working fine. What I would like to do though is make these dynamic, so they show the previous year, the current year and the next year. That way, come 2014 I don't need to go through all my charts and change the expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created three script variables:&lt;/P&gt;&lt;P&gt;let vPriorYear&amp;nbsp; = year(today())-1;&lt;/P&gt;&lt;P&gt;let vCurrentYear&amp;nbsp; = year(today());&lt;/P&gt;&lt;P&gt;let vNextYear = year(today())+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried updating the expression to: =sum({$&amp;lt;YEAR(SERVICEDATE)={$(vPriorYear)}&amp;gt;}SALESPRICEEUR) and although the expression editor confirms this is OK, I get no results returned. I have verified the content of the variables by just displaying them in a text object, so I know the values are in there as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Dec 2013 11:44:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-12-19T11:44:10Z</dc:date>
    <item>
      <title>Set Analysis issue...</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-issue/m-p/507652#M189792</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'm having some issues with set analysis in a chart I'm trying to create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My fact data has a field SERVICEDATE. I am trying to create a chart that plots values for 2012, 2013 and 2014 alongside each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using expressions such as: =sum({$&amp;lt;SERVICEDATE={'*/2012'}&amp;gt;}SALESPRICEEUR) is working fine. What I would like to do though is make these dynamic, so they show the previous year, the current year and the next year. That way, come 2014 I don't need to go through all my charts and change the expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created three script variables:&lt;/P&gt;&lt;P&gt;let vPriorYear&amp;nbsp; = year(today())-1;&lt;/P&gt;&lt;P&gt;let vCurrentYear&amp;nbsp; = year(today());&lt;/P&gt;&lt;P&gt;let vNextYear = year(today())+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried updating the expression to: =sum({$&amp;lt;YEAR(SERVICEDATE)={$(vPriorYear)}&amp;gt;}SALESPRICEEUR) and although the expression editor confirms this is OK, I get no results returned. I have verified the content of the variables by just displaying them in a text object, so I know the values are in there as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 11:44:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-issue/m-p/507652#M189792</guid>
      <dc:creator />
      <dc:date>2013-12-19T11:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis issue...</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-issue/m-p/507653#M189793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't use an expression like year(ServiceDate) on the left side of a field modifier in a set expression, only field names are allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So best would be to create a year field in your data model using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SERVICEDATE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year(SERVICEDATE) as SERVICEYEAR,&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(or create a master calender), and then use this field in your set expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;SERVICEYEAR = {$(vPriorYear)}&amp;gt;} SALESPRICEEUR)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 14:11:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-issue/m-p/507653#M189793</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-12-19T14:11:14Z</dc:date>
    </item>
  </channel>
</rss>

