<?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 Using a calculated variable in set analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117420#M19227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use set analysis to hold in place three field values: gl.Yr, gl.Prd, and the left digit of Gl-code&lt;/P&gt;&lt;P&gt;I tried to use a variable to create a new field that is a concatenation of those three fields:&lt;/P&gt;&lt;P&gt;vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;final expression: fabs(sum( {&amp;lt;$(vYrPrdLeft)={‘201685’}&amp;gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note I have made the quotes double quotes and also added an equal sign:&lt;/P&gt;&lt;P&gt;fabs(sum( {&amp;lt;$(vYrPrdLeft)={"=201685"}&amp;gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This did not work in my set analysis, presumably because calculated variables do not work as field names in set analysis.&amp;nbsp; I have been unable to find an explanation for this, but that has been my experience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to simply use multiple fields in my set analysis but only one is ever accepted:&lt;/P&gt;&lt;P&gt;I have the concatenation ($(vYrPrdLeft)) as a filter on the sheet and when “201685” is selected, the correct total number is returned:&lt;/P&gt;&lt;P&gt;421,892&lt;/P&gt;&lt;P&gt;When I clear the filter and use this as my expression:&lt;/P&gt;&lt;P&gt;fabs(sum( {&amp;lt;[Gl-code]={"5*"}&amp;gt;} {&amp;lt;[gl.Yr]={'2016'}&amp;gt;} {&amp;lt;[gl.Prd]={'8'}&amp;gt;} [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;It returns this number as my total:&lt;/P&gt;&lt;P&gt;4,978,428&lt;/P&gt;&lt;P&gt;Clearly ignoring the second two set analyses &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, I tried to create a calculated field in the data load:&lt;/P&gt;&lt;P&gt;[gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1) AS “vYrPrdLeft”&lt;/P&gt;&lt;P&gt;This threw an error so I tried to add it as a variable which did not throw an error but was ignored completely.&amp;nbsp; At the end of my data load, I added:&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;LET vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;I also tried it without the LET:&lt;/P&gt;&lt;P&gt;vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;These were all ignored and did not become available in the sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use set analysis or a variable or a calculated field to lock down those three fields? I’m open to other ways to do this too.&amp;nbsp; IF won’t work since it will just be looking to see if something is true, which it won’t be unless those fields are selected. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Aug 2016 18:14:07 GMT</pubDate>
    <dc:creator>sstefancies</dc:creator>
    <dc:date>2016-08-16T18:14:07Z</dc:date>
    <item>
      <title>Using a calculated variable in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117420#M19227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use set analysis to hold in place three field values: gl.Yr, gl.Prd, and the left digit of Gl-code&lt;/P&gt;&lt;P&gt;I tried to use a variable to create a new field that is a concatenation of those three fields:&lt;/P&gt;&lt;P&gt;vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;final expression: fabs(sum( {&amp;lt;$(vYrPrdLeft)={‘201685’}&amp;gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note I have made the quotes double quotes and also added an equal sign:&lt;/P&gt;&lt;P&gt;fabs(sum( {&amp;lt;$(vYrPrdLeft)={"=201685"}&amp;gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This did not work in my set analysis, presumably because calculated variables do not work as field names in set analysis.&amp;nbsp; I have been unable to find an explanation for this, but that has been my experience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to simply use multiple fields in my set analysis but only one is ever accepted:&lt;/P&gt;&lt;P&gt;I have the concatenation ($(vYrPrdLeft)) as a filter on the sheet and when “201685” is selected, the correct total number is returned:&lt;/P&gt;&lt;P&gt;421,892&lt;/P&gt;&lt;P&gt;When I clear the filter and use this as my expression:&lt;/P&gt;&lt;P&gt;fabs(sum( {&amp;lt;[Gl-code]={"5*"}&amp;gt;} {&amp;lt;[gl.Yr]={'2016'}&amp;gt;} {&amp;lt;[gl.Prd]={'8'}&amp;gt;} [Debit-amt]-[Credit-amt]))&lt;/P&gt;&lt;P&gt;It returns this number as my total:&lt;/P&gt;&lt;P&gt;4,978,428&lt;/P&gt;&lt;P&gt;Clearly ignoring the second two set analyses &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, I tried to create a calculated field in the data load:&lt;/P&gt;&lt;P&gt;[gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1) AS “vYrPrdLeft”&lt;/P&gt;&lt;P&gt;This threw an error so I tried to add it as a variable which did not throw an error but was ignored completely.&amp;nbsp; At the end of my data load, I added:&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;LET vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;I also tried it without the LET:&lt;/P&gt;&lt;P&gt;vYrPrdLeft = [gl.Yr]&amp;amp;[gl.Prd]&amp;amp;left([Gl-code],1)&lt;/P&gt;&lt;P&gt;These were all ignored and did not become available in the sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use set analysis or a variable or a calculated field to lock down those three fields? I’m open to other ways to do this too.&amp;nbsp; IF won’t work since it will just be looking to see if something is true, which it won’t be unless those fields are selected. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2016 18:14:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117420#M19227</guid>
      <dc:creator>sstefancies</dc:creator>
      <dc:date>2016-08-16T18:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using a calculated variable in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117421#M19228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fabs(Sum({&amp;lt;[Gl-code]={"5*"}&lt;SPAN style="color: #ff0000;"&gt;,&lt;/SPAN&gt; [gl.Yr]={'2016'}&lt;SPAN style="color: #ff0000;"&gt;,&lt;/SPAN&gt; [gl.Prd]={'8'}&amp;gt;} [Debit-amt]-[Credit-amt]))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2016 18:21:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117421#M19228</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-16T18:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using a calculated variable in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117422#M19229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That worked!&amp;nbsp; To be honest that answers a question I have had for a long time now - how to use multiple fields in a single set analysis - and had a lot of trouble finding an answer.&amp;nbsp; Thank you so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2016 18:25:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-a-calculated-variable-in-set-analysis/m-p/1117422#M19229</guid>
      <dc:creator>sstefancies</dc:creator>
      <dc:date>2016-08-16T18:25:56Z</dc:date>
    </item>
  </channel>
</rss>

