<?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: Storing the straight table's (complex expression) column Total in a variable for later reference in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328134#M839729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;RangeSum in place of your Sum&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 May 2017 16:15:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-05-11T16:15:19Z</dc:date>
    <item>
      <title>Storing the straight table's (complex expression) column Total in a variable for later reference</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328133#M839728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am going to ask a question very similar to &lt;A _jive_internal="true" href="https://community.qlik.com/thread/54232" target="_blank"&gt;this one&lt;/A&gt;, but I started a new discussion because the solution there does not work for me and I suspect because of the complex expression. So let me show you a simple straight table (there is only one row in this example, but there can be more):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="straight.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/162982_straight.PNG" style="height: auto; display: block; margin-left: auto; margin-right: auto;" /&gt;&lt;/P&gt;&lt;P&gt;The first two columns are dimensions. Qta is an expression based on Set Analysis for filtering based on a different field:&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Sum&lt;/SPAN&gt;({&amp;lt;Tipo_MP = {10}&amp;gt;} Qta_composizione)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now the last column, here it is the definition:&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Qta*$(&lt;STRONG&gt;&lt;EM&gt;ValorizzazioneUnitariaMP_C1&lt;/EM&gt;&lt;/STRONG&gt;(id_method, unit_value))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the Qta column's value is multiplied by the result returned from a variable with parameters. The purpose of this variable is to perform different math according to the value of the &lt;STRONG&gt;id_method&lt;/STRONG&gt; field. This variable is much like a function. Here it&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt; is &lt;SPAN style="font-size: 13.3333px; font-family: arial, helvetica, sans-serif;"&gt;its &lt;/SPAN&gt;def&lt;/SPAN&gt;inition (just a simple example, this variable can eventually be more complex than this):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Pick&lt;/SPAN&gt;(Num($1), Num($2), &lt;SPAN style="color: #0000ff;"&gt;AVG&lt;/SPAN&gt;(valore_medio))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you see, some pick choices may also be aggregates.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I need next is to store in another variable the total result in the table (which is configured as sum of rows).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up to now, any attempt to use Sum(Aggr(...)) construct on the above expression leads to result 0.&lt;/P&gt;&lt;P&gt;The following is my last iteration of a variable definition before asking for help:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=Sum(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Aggr(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; {&amp;lt;Tipo_MP = {10}&amp;gt;} Qta_composizione*($(ValorizzazioneUnitariaMP_C1 (&lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333px; text-align: center;"&gt;id_method&lt;/SPAN&gt;, &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333px; text-align: center;"&gt;unit_value&lt;/SPAN&gt;))),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Descrizione_MP, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to achieve my purpose?&lt;/P&gt;&lt;P&gt;Thanks in advance for your help,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;FV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328133#M839728</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the straight table's (complex expression) column Total in a variable for later reference</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328134#M839729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;RangeSum in place of your Sum&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2017 16:15:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328134#M839729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-11T16:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the straight table's (complex expression) column Total in a variable for later reference</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328135#M839730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi and thanks for your answer.&lt;/P&gt;&lt;P&gt;Unfortunately no luck, I still get a result of 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 08:02:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328135#M839730</guid>
      <dc:creator />
      <dc:date>2017-05-12T08:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the straight table's (complex expression) column Total in a variable for later reference</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328136#M839731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just for the purpose of sharing, after some trials and errors, I eventually got a variable definition that yields the intended result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=Sum( {&amp;lt;Tipo_MP = {10}&amp;gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Aggr(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Qta_composizione*$(ValorizzazioneUnitariaMP_C1(&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 13.3333px; text-align: center;"&gt;id_method&lt;/SPAN&gt;, &lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 13.3333px; text-align: center;"&gt;unit_value&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; , &lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 13px;"&gt;Descrizione_MP&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not only the structure, but there was also a syntax detail that prevented the expression from working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[...] &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333px;"&gt;ValorizzazioneUnitariaMP_C&lt;SPAN style="; color: #ff00ff;"&gt;&lt;STRONG&gt;1(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 13.3333px; text-align: center;"&gt;id_method&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333px;"&gt;,&lt;/SPAN&gt; [...]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I initially had a blank space between the variable name and the parameters paranthesis which I had to remove as in the above line.&lt;/P&gt;&lt;P&gt;So far so good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 14:06:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328136#M839731</guid>
      <dc:creator />
      <dc:date>2017-05-12T14:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the straight table's (complex expression) column Total in a variable for later reference</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328137#M839732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it figured it out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 15:48:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-the-straight-table-s-complex-expression-column-Total-in/m-p/1328137#M839732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-12T15:48:57Z</dc:date>
    </item>
  </channel>
</rss>

