<?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: Use of Variable &amp; Expression for Comparison in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652492#M475089</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone please suggest something on this one. This is really urgent.&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, 11 Aug 2014 17:57:37 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-08-11T17:57:37Z</dc:date>
    <item>
      <title>Use of Variable &amp; Expression for Comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652491#M475088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here is a situation...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have a dataset that has last 2 quaters data for now (will have close to 6 - 8 quarters data in future) and&amp;nbsp; would like to do a comparison depending on what user wants to look at i.e. there are 4 inputboxes that would allow user to compare data from any of the previous quarters. User can choose to enter either 2, 3&amp;nbsp; or all 4 input boxes for comparison.&amp;nbsp; (THIS PART IS DONE - INPUT BOX CREATED AND CORRESPONDING VARIABLES HAVE ALS BEEN DEFINED WHERE THE VALUES ARE STORED AND WILL BE USED IN EXPRESSION LATER ON).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User Input Variables :&lt;/P&gt;&lt;P&gt;vCur_Val&amp;nbsp; = 2014Q2&lt;/P&gt;&lt;P&gt;vPrev_Val1 = 2013Q4&lt;/P&gt;&lt;P&gt;vPrev_Val2 = 2013Q2&lt;/P&gt;&lt;P&gt;vPrev_Val3 = 2012Q4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) The target report that is required to be published has a specific format which I am trying to replicate in QlikView Pivot structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg.&lt;/P&gt;&lt;P&gt;Sample format of the traget report (Last column (Calculations) is not the part of actual report but to explain how the proportions are being calculated)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="623"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl77" height="41" width="63"&gt;Items&lt;/TD&gt;&lt;TD class="xl78" width="63"&gt;Amounts &lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2014Q2&lt;/TD&gt;&lt;TD class="xl79" width="63"&gt;Amounts&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2013Q4&lt;/TD&gt;&lt;TD class="xl80" width="80"&gt;Proportions&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2014Q2&lt;/TD&gt;&lt;TD class="xl81" width="80"&gt;Proportions&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2013Q4&lt;/TD&gt;&lt;TD class="xl65" width="214"&gt;Calculation &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;GL&lt;/TD&gt;&lt;TD class="xl67"&gt;&amp;nbsp;&amp;nbsp; 500,000 &lt;/TD&gt;&lt;TD class="xl68"&gt;&amp;nbsp;&amp;nbsp; 550,000 &lt;/TD&gt;&lt;TD class="xl71"&gt;-&lt;/TD&gt;&lt;TD class="xl72"&gt;-&lt;/TD&gt;&lt;TD&gt;No Calculation for Proportion&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;CL&lt;/TD&gt;&lt;TD class="xl67"&gt;&amp;nbsp;&amp;nbsp; 250,000 &lt;/TD&gt;&lt;TD class="xl68"&gt;&amp;nbsp;&amp;nbsp; 255,000 &lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;50.00%&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;46.36%&lt;/TD&gt;&lt;TD&gt;CL/GL &amp;gt;&amp;gt; (CL as proportion on GL)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;GB&lt;/TD&gt;&lt;TD class="xl67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50,000 &lt;/TD&gt;&lt;TD class="xl68"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60,000 &lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;10.00%&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;10.91%&lt;/TD&gt;&lt;TD&gt;GB/GL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;CB&lt;/TD&gt;&lt;TD class="xl67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30,000 &lt;/TD&gt;&lt;TD class="xl68"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33,000 &lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;60.00%&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;55.00%&lt;/TD&gt;&lt;TD&gt;CB/GB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;BD&lt;/TD&gt;&lt;TD class="xl67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,500 &lt;/TD&gt;&lt;TD class="xl68"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,500 &lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;1.00%&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;0.98%&lt;/TD&gt;&lt;TD&gt;BD/CL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl76" height="21"&gt;OPX&lt;/TD&gt;&lt;TD class="xl69"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12,500 &lt;/TD&gt;&lt;TD class="xl70"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16,250 &lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;2.50%&lt;/TD&gt;&lt;TD align="right" class="xl74"&gt;2.50%&lt;/TD&gt;&lt;TD&gt;OPX/GL&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The report in qlikview till the amounts column has been created and amounts get populated for comparison based on user inputs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Problem part in the project : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Next step is to create the proportions field where it is getting a bit tricky.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I tried -&lt;/P&gt;&lt;P&gt;- Created variables to fetch the sum of each item to be used in expression later.&lt;/P&gt;&lt;P&gt;eg. of calculation performed in variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;SPAN style="color: #808080;"&gt;GB as proportion of GL:&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; vGBProp &amp;gt;&amp;gt;&amp;nbsp;&amp;nbsp; Sum({$&amp;lt;[Items]={'GB'}&amp;gt;} [Amounts]/1000)&amp;nbsp; /&amp;nbsp; Sum({$&amp;lt;[Items]={'GL'}&amp;gt;} [Amounts]/1000) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-size: 10pt;"&gt;BD as proportion of CL: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; vBDProp &amp;gt;&amp;gt;&amp;nbsp;&amp;nbsp; Sum({$&amp;lt;[Items]={'BD'}&amp;gt;} [Amounts]/1000)&amp;nbsp; /&amp;nbsp; Sum({$&amp;lt;[Items]={'CL'}&amp;gt;} [Amounts]/1000) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;- In next step I tried to populate the variable calculation in Pivot using the following formula -&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;For Current valuation proportions: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;if([val_qtr]&lt;SPAN&gt;=vCur_Val AND [Items] = 'GB', vGBProp, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;SPAN&gt;if([val_qtr]=vCur_Val AND [Items] = 'BD', vBDProp, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;If([val_qtr]=vCur_Val AND [Items] &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;&lt;SPAN style="color: #0000ff;"&gt;= other item, some calculation, and so on...&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;It doesn't calculate anything with the above formula. I would need similar expression for the other user input variables for comparative analysis. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Is there any way I can achieve this ?? Getting the proportions of different quarters based on user inputs ?? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Please advice. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks &amp;amp; Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Vinay Gera&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Aug 2014 19:46:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652491#M475088</guid>
      <dc:creator />
      <dc:date>2014-08-10T19:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Variable &amp; Expression for Comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652492#M475089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone please suggest something on this one. This is really urgent.&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, 11 Aug 2014 17:57:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652492#M475089</guid>
      <dc:creator />
      <dc:date>2014-08-11T17:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Variable &amp; Expression for Comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652493#M475090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want calculate inside a dimension-value the values from an another dimension-value you need to tell it the expression, instead of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Sum({$&amp;lt;[Items]={'GB'}&amp;gt;} [Amounts]/1000)&amp;nbsp; /&amp;nbsp; Sum({$&amp;lt;[Items]={'GL'}&amp;gt;} [Amounts]/1000)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Sum([Amounts])&amp;nbsp; /&amp;nbsp; Sum({1&amp;lt;[Items]={'GL'}, [val_qtr] = {$(vPrev_Val1)}&amp;gt;} [Amounts]) /1000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively you could use above().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here it seemed to miss the $-expansion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;For Current valuation proportions: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Instead:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;if([val_qtr]=vCur_Val AND [Items] = 'GB', vGBProp, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if([val_qtr]=vCur_Val AND [Items] = 'GB', $(vGBProp), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For such a nested if you could also use pick(match()):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pick(match([Items], 'GL', 'GB', ....), Expression1, Expression2, ....)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 19:32:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652493#M475090</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-08-11T19:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Variable &amp; Expression for Comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652494#M475091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ThankYou so much for your answer. Pick &amp;amp; Match was not the exact solution for the query. Howver, it did give a direction which solved teh problem&amp;nbsp; :).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 09:39:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-of-Variable-Expression-for-Comparison/m-p/652494#M475091</guid>
      <dc:creator />
      <dc:date>2014-09-03T09:39:05Z</dc:date>
    </item>
  </channel>
</rss>

