<?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: Set Analysis SUMing Variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549586#M688418</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe a variable will always hold a single value, not an array / field / dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can set the variable to a field &lt;EM&gt;name,&lt;/EM&gt; then use dollar sign expansion to replace the variable by the name and QV will 'interprete' the variable as a field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But your current definition is none of both, it's not a field name and doesn't even come close to an array / field / dimension, because you are using an aggregate function, which will return a single value / scalar.&lt;/P&gt;&lt;P&gt;[edit: Or, if you just defined the text in the variable, at best the variable will be replaced by the aggregation function text, but this will lead to an aggregation within an aggregation and is not allowed except using advanced aggregation (aggr() function).]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this makes sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Oct 2013 13:27:46 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-10-30T13:27:46Z</dc:date>
    <item>
      <title>Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549583#M688415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just wondering if anyone can give me guidance on this one. I've created several variables using SET ANALYSIS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vCurentSY which represents a the Sales Season we are in&lt;/P&gt;&lt;P&gt;vMostRecentSnapshot which grabs the most recent snapshot date we have available&lt;/P&gt;&lt;P&gt;vNetPaidTravelers which represents all of our Confirmed Travelers&lt;/P&gt;&lt;P&gt;vGrossPaidTravelers which represents all of our Confirmed &amp;amp; Cancelled Travelers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I basically need to create Additional variables for Cancelled Travelers I wrote the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;&lt;/P&gt;&lt;P&gt;dimSalesOp.SalesYear={'$(vCurrentSY)'}&lt;/P&gt;&lt;P&gt;,dimSnapshotDate.SnapshotDate={'$(vMostRecentSnapshot)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;(vNetPaidTravelers-vGrossPaidTravelers) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- This returns a value of Zero&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;&lt;/P&gt;&lt;P&gt;dimSalesOp.SalesYear={'$(vCurrentSY)'}&lt;/P&gt;&lt;P&gt;,dimSnapshotDate.SnapshotDate={'$(vMostRecentSnapshot)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;($(vNetPaidTravelers)-$(vGrossPaidTravelers) ))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This returns a NULL value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: Can this be done? Can I use a variable as a FIELD and not a VALUE in SET ANALYSIS. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:00:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549583#M688415</guid>
      <dc:creator />
      <dc:date>2013-10-30T13:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549584#M688416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if I understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What's the definition of vNetPaidTravelers and vGrossPaidTravelers?&lt;/P&gt;&lt;P&gt;Do your variables expand to a valid field name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:11:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549584#M688416</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-30T13:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549585#M688417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;vNetPaidTravelers and vGrossPaidTravelers do indeed take into account fields from our database. I can't do specifics, but I can generally tell you what they consist of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vNetPaidTravelers&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;COUNT({$&amp;lt;&lt;/P&gt;&lt;P&gt;NetAC={'&amp;gt;0'}&lt;/P&gt;&lt;P&gt;, NetPayingTravelers={'&amp;gt;0'}&lt;/P&gt;&lt;P&gt;, .CancelledDateEntered={'NULL'}&lt;/P&gt;&lt;P&gt;, OrderStatusCode={'AC'}&lt;/P&gt;&lt;P&gt;, OrderSubStatusCode={'ACAC','ACLA'}&lt;/P&gt;&lt;P&gt;, IsFreePlace={'NO'}&lt;/P&gt;&lt;P&gt;&amp;gt;}DISTINCT Traveler_Id)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vGrossPaidTravelers&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;COUNT({$&amp;lt;&lt;/P&gt;&lt;P&gt;GrossAC={'&amp;gt;0'}&lt;/P&gt;&lt;P&gt;,GrossPayingTravelers={'&amp;gt;0'}&lt;/P&gt;&lt;P&gt;, OrderStatusCode={'AC','CA'}&lt;/P&gt;&lt;P&gt;,IsFreePlace={'NO'}&lt;/P&gt;&lt;P&gt;,SalesYear={'$(vCurrentSY)'}&lt;/P&gt;&lt;P&gt;,SnapshotDate={'$(vMostRecentSnapshot)'}&lt;/P&gt;&lt;P&gt;&amp;gt;}DISTINCT PaxOrder_Id)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be clear&amp;nbsp; though, I don't need a specific solution (Although I am certainly open to one) - there are other fields in our tables I can use to establish Cancelled Travelers. I have tried to use Variables in similar ways in SET ANALYSIS with little success. I always get them to work as Values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;SalesYear={'$(vCurrentSY)'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But cannot get them to calculate properly as FIELDS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COUNT({$&amp;lt;{SalesYear={'$(vCurrentSY)'}&amp;gt;}DISTINCT vGrossPaidTravelers)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just want to know if variables CAN be used in this manner. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:20:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549585#M688417</guid>
      <dc:creator />
      <dc:date>2013-10-30T13:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549586#M688418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe a variable will always hold a single value, not an array / field / dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can set the variable to a field &lt;EM&gt;name,&lt;/EM&gt; then use dollar sign expansion to replace the variable by the name and QV will 'interprete' the variable as a field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But your current definition is none of both, it's not a field name and doesn't even come close to an array / field / dimension, because you are using an aggregate function, which will return a single value / scalar.&lt;/P&gt;&lt;P&gt;[edit: Or, if you just defined the text in the variable, at best the variable will be replaced by the aggregation function text, but this will lead to an aggregation within an aggregation and is not allowed except using advanced aggregation (aggr() function).]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this makes sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:27:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549586#M688418</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-30T13:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549587#M688419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes totally makes sense!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if the variable = a Number I SHOULD be able to SUM it in another SET ANALYSIS correct? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:30:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549587#M688419</guid>
      <dc:creator />
      <dc:date>2013-10-30T13:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549588#M688420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your variables expand to numbers and you try to use something like&lt;/P&gt;&lt;P&gt;=sum( $(vVar1) - $(vVar2) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this should return the difference of the two variables, but it would be sufficient to just use&lt;/P&gt;&lt;P&gt;=vVar1 - vVar2&lt;/P&gt;&lt;P&gt;then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set analysis added to above sum() function won't work, because your expanded variables are not connected to your data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But maybe I am misunderstanding what you are trying to achieve..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549588#M688420</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-30T13:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis SUMing Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549589#M688421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope totally clear now thanks! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 13:40:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-SUMing-Variables/m-p/549589#M688421</guid>
      <dc:creator />
      <dc:date>2013-10-30T13:40:05Z</dc:date>
    </item>
  </channel>
</rss>

