<?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: Variable in Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353984#M415748</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know that the data set specified by your set analysis expression is calculated before the table object is calculated? And based on all data that is currently active (including selections and so on) or on the total data set if you used {1} inside your set analysis expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you take that into account, you should be able to copy your variable &lt;SPAN style="font-family: 'courier new', courier;"&gt;$(vWeekShift)&lt;/SPAN&gt; equally well outside of every other object, like in a text box. Does it return a value then? Knowing that to calculate &lt;SPAN style="font-family: 'courier new', courier;"&gt;vWeekShift&lt;/SPAN&gt;, you use field &lt;SPAN style="font-family: 'courier new', courier;"&gt;QWNum&lt;/SPAN&gt; as a first operand &lt;EM&gt;and without aggregation function&lt;/EM&gt; on your entire data set, I wouldn't think so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW you can easily find the troublesome part in a complex variable-based expressions by pulling it apart, putting the pieces in text boxes and observing what happens. In your case, the calculation of &lt;SPAN style="font-family: 'courier new', courier;"&gt;vCurrentWeek&lt;/SPAN&gt; works like a charm in a text box, but &lt;SPAN style="font-family: 'courier new', courier;"&gt;vWeekShift&lt;/SPAN&gt; doesn't...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 May 2017 12:50:43 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2017-05-29T12:50:43Z</dc:date>
    <item>
      <title>Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353977#M415741</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 use variable for special week number in Set Analysis, but is not functioning as intended. Variable calculate week number as follows:&lt;/P&gt;&lt;P&gt;next week =&amp;gt; -1&lt;/P&gt;&lt;P&gt;actual week =&amp;gt; 0&lt;/P&gt;&lt;P&gt;previous week =&amp;gt; 1&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result is integer number.&lt;/P&gt;&lt;P&gt;When i use this variable in table as expression, it works fine. (column Week)&lt;/P&gt;&lt;P&gt;When i use it in Set Analysis result is null. (Total Q Dyn)&lt;/P&gt;&lt;P&gt;When i use formula with set analysis with fixed number instead of variable, it works fine. (Total Q Fixed)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my whole calculation:&lt;/P&gt;&lt;P&gt;1. LET vToday = Date(Today(),'YYYYMMDD');&lt;/P&gt;&lt;P&gt;2. vCurrentWeek = Only( {1&amp;lt;[DateKey]={'$(vToday)'}&amp;gt;} QWNum) - take current week from Calendar&lt;/P&gt;&lt;P&gt;3. vWeekShift = (QWNum - $(=$(vCurrentWeek)))*(-1) - calculate week number in table&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="165089" alt="Untitled2.png" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/165089_Untitled2.png" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and set analysis:&lt;/P&gt;&lt;P&gt;4. SUM({$&amp;lt;[~SName] = {'EBR'}, QWNum =, RepYQW =, [~SnapNum] = {$(vWeekShift)}&amp;gt;} TOTAL (Quantity))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Snapshot Dimension:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="165087" alt="Untitled.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/165087_Untitled.png" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don not know why, that specific variable is not usable in set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result should be: for actual week it should count from snapshot with [~SnapNum] = 0, for previous week (1) should count from snapshot with [~SnapNum] = 1 and so on. No calendar filter should apply on this calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:06:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353977#M415741</guid>
      <dc:creator />
      <dc:date>2017-05-29T12:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353978#M415742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You forget the ' symbol&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this: &lt;STRONG style=": ; color: #ff0000; font-size: 18pt;"&gt;'&lt;/STRONG&gt;$(vWeekShift)&lt;STRONG style=": ; color: #ff0000; font-size: 18pt;"&gt;'&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:15:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353978#M415742</guid>
      <dc:creator>jmmayoral3</dc:creator>
      <dc:date>2017-05-29T12:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353979#M415743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I already try that, no change.... And it is a number so a don not have to use ' symbol, i supposed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:21:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353979#M415743</guid>
      <dc:creator />
      <dc:date>2017-05-29T12:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353980#M415744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jozef,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this in set analysis:&lt;/P&gt;&lt;P&gt; [~SnapNum] = {'=$(vWeekShift)'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jacek.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:36:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353980#M415744</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-29T12:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353981#M415745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;vWeekShift is not defined with an aggregation function (like Max()/Min()...), so it will have no unique value in the set expression. Also the set expression and variable expansion happen before the chart is evaluated, so you cannot execute these on a row by row basis as I think you require.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353981#M415745</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2017-05-29T12:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353982#M415746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try some combinations, how to put that variable into set analysis, but with no success. I think there is something with variable interpretation in set analysis. &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; I try your idea, but the same result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:41:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353982#M415746</guid>
      <dc:creator />
      <dc:date>2017-05-29T12:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353983#M415747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;uff... ok this is a problem &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;, so i have to find out, how to change the variable...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:43:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353983#M415747</guid>
      <dc:creator />
      <dc:date>2017-05-29T12:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353984#M415748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know that the data set specified by your set analysis expression is calculated before the table object is calculated? And based on all data that is currently active (including selections and so on) or on the total data set if you used {1} inside your set analysis expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you take that into account, you should be able to copy your variable &lt;SPAN style="font-family: 'courier new', courier;"&gt;$(vWeekShift)&lt;/SPAN&gt; equally well outside of every other object, like in a text box. Does it return a value then? Knowing that to calculate &lt;SPAN style="font-family: 'courier new', courier;"&gt;vWeekShift&lt;/SPAN&gt;, you use field &lt;SPAN style="font-family: 'courier new', courier;"&gt;QWNum&lt;/SPAN&gt; as a first operand &lt;EM&gt;and without aggregation function&lt;/EM&gt; on your entire data set, I wouldn't think so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW you can easily find the troublesome part in a complex variable-based expressions by pulling it apart, putting the pieces in text boxes and observing what happens. In your case, the calculation of &lt;SPAN style="font-family: 'courier new', courier;"&gt;vCurrentWeek&lt;/SPAN&gt; works like a charm in a text box, but &lt;SPAN style="font-family: 'courier new', courier;"&gt;vWeekShift&lt;/SPAN&gt; doesn't...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 12:50:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353984#M415748</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-05-29T12:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353985#M415749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct answer by &lt;/P&gt;&lt;H1 class="n fn font-color-white" style="padding-bottom: 15px; font-weight: normal; font-size: 21px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #ffffff; background-color: #404040;"&gt;Jacek WaÅ‚aszek&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 09:36:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Set-Analysis/m-p/1353985#M415749</guid>
      <dc:creator>dirk1955</dc:creator>
      <dc:date>2018-05-16T09:36:56Z</dc:date>
    </item>
  </channel>
</rss>

