<?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 Need some help with defining a set analysis formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83690#M608475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having trouble correctly defining a set analysis expression in a script. When I use the formula directly in a chart it works as intended. When I try to define it in the script I haven't been able to make it work. Below is a simplified script demonstrating the problem with the qvw attached. When SelectedYear is selected the CYSales value should show the sales for that year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Sales chart in the qvw shows the behavior of the formula applied in the script, the chart and via Settings-&amp;gt;Valriable Overview&lt;/P&gt;&lt;P&gt;The column labeled 'CYSales_Chart' demonstrates the desired results. Ideally I'd also like to use the CurrentYear variable as opposed to Max(SelectedYear) in the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set CurrentYear = Max(SelectedYear);&lt;/P&gt;&lt;P&gt;set LastYear = Max(SelectedYear)-1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set CYSales_Script = sum( {$&amp;lt;Year = {$(#=Max(SelectedYear))}&amp;gt;} Sales );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales:&lt;/P&gt;&lt;P&gt;load * Inline [&lt;/P&gt;&lt;P&gt;Customer, Year, Sales&lt;/P&gt;&lt;P&gt;CustA, 2016, 10000,&lt;/P&gt;&lt;P&gt;CustA, 2017, 12000,&lt;/P&gt;&lt;P&gt;CustA, 2018, 15000,&lt;/P&gt;&lt;P&gt;CustB, 2016, 1000,&lt;/P&gt;&lt;P&gt;CustB, 2017, 1200,&lt;/P&gt;&lt;P&gt;CustB, 2018, 1500,&lt;/P&gt;&lt;P&gt;CustC, 2016, 100,&lt;/P&gt;&lt;P&gt;CustC, 2017, 120,&lt;/P&gt;&lt;P&gt;CustC, 2018, 150,&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Years:&lt;/P&gt;&lt;P&gt;load Distinct Year as SelectedYear Resident Sales;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Feb 2018 22:19:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-09T22:19:30Z</dc:date>
    <item>
      <title>Need some help with defining a set analysis formula</title>
      <link>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83690#M608475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having trouble correctly defining a set analysis expression in a script. When I use the formula directly in a chart it works as intended. When I try to define it in the script I haven't been able to make it work. Below is a simplified script demonstrating the problem with the qvw attached. When SelectedYear is selected the CYSales value should show the sales for that year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Sales chart in the qvw shows the behavior of the formula applied in the script, the chart and via Settings-&amp;gt;Valriable Overview&lt;/P&gt;&lt;P&gt;The column labeled 'CYSales_Chart' demonstrates the desired results. Ideally I'd also like to use the CurrentYear variable as opposed to Max(SelectedYear) in the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set CurrentYear = Max(SelectedYear);&lt;/P&gt;&lt;P&gt;set LastYear = Max(SelectedYear)-1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set CYSales_Script = sum( {$&amp;lt;Year = {$(#=Max(SelectedYear))}&amp;gt;} Sales );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales:&lt;/P&gt;&lt;P&gt;load * Inline [&lt;/P&gt;&lt;P&gt;Customer, Year, Sales&lt;/P&gt;&lt;P&gt;CustA, 2016, 10000,&lt;/P&gt;&lt;P&gt;CustA, 2017, 12000,&lt;/P&gt;&lt;P&gt;CustA, 2018, 15000,&lt;/P&gt;&lt;P&gt;CustB, 2016, 1000,&lt;/P&gt;&lt;P&gt;CustB, 2017, 1200,&lt;/P&gt;&lt;P&gt;CustB, 2018, 1500,&lt;/P&gt;&lt;P&gt;CustC, 2016, 100,&lt;/P&gt;&lt;P&gt;CustC, 2017, 120,&lt;/P&gt;&lt;P&gt;CustC, 2018, 150,&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Years:&lt;/P&gt;&lt;P&gt;load Distinct Year as SelectedYear Resident Sales;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 22:19:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83690#M608475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-09T22:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help with defining a set analysis formula</title>
      <link>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83691#M608476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/162827"&gt;Re: Stop Dollar Sign Expansion in the script (Escape Character ??? )&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 23:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83691#M608476</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2018-02-09T23:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help with defining a set analysis formula</title>
      <link>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83692#M608477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan - that works perfectly. Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2018 14:26:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-some-help-with-defining-a-set-analysis-formula/m-p/83692#M608477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-12T14:26:04Z</dc:date>
    </item>
  </channel>
</rss>

