<?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: Return calculated value from pivot for set dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729589#M537617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great. Kindly close out the thread with the correct/helpful messages.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Sep 2014 20:56:13 GMT</pubDate>
    <dc:creator>JonnyPoole</dc:creator>
    <dc:date>2014-09-30T20:56:13Z</dc:date>
    <item>
      <title>Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729582#M537610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to return the results of a calculated value while looking at one set dimension for a pivot. For example I have a pivot looking at the Grade and Gender of a person and want to return the results of only a Gender of M regardless of what the actual Gender is of the line. I have an example of my data below, the expected result always returns the avg rate of the Grade for the M Gender. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="311"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="56"&gt;Grade&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="60"&gt;Gender&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="77"&gt;Avg Rate&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="118"&gt;Expected Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="34" rowspan="2" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;60&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none; border-left: none;"&gt;M&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;50&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;M&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;70&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;70&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="34" rowspan="2" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;80&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none; border-left: none;"&gt;M&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;90&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried many different expressions but cannot get any to consistently return the right value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 15:03:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729582#M537610</guid>
      <dc:creator />
      <dc:date>2014-09-30T15:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729583#M537611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression for expected result should be something like:&lt;/P&gt;&lt;P&gt;Avg({&amp;lt;Gender={'M'}&amp;gt;} Rate)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 15:08:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729583#M537611</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2014-09-30T15:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729584#M537612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is only adding the average to the row with the M Gender and a 0 for all rows with a F Gender. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 16:17:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729584#M537612</guid>
      <dc:creator />
      <dc:date>2014-09-30T16:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729585#M537613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe this. but i'd feel better if you post the raw data or the qvw&lt;/P&gt;&lt;P&gt;if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Gender = 'M',&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(&amp;nbsp; [Avg Rate] ) ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( Gender = 'F', sum ( {$&amp;lt;Gender={'M'}&amp;gt;} [Avg Rate] ) )&lt;/P&gt;&lt;P&gt;) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 16:22:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729585#M537613</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-09-30T16:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729586#M537614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for your help but that did not work either. Sorry, I am new and do not know how to upload my data. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 19:39:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729586#M537614</guid>
      <dc:creator />
      <dc:date>2014-09-30T19:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729587#M537615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See if this will work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( Gender='F',&amp;nbsp; sum(&amp;nbsp; total &amp;lt;Grade&amp;gt; [Avg Rate]) - sum([Avg Rate]) , sum([Avg Rate]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it with the few rows of data you had in your first post.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, when you reply, go to 'Use Advanced Editor' and then you can attach QVW files or data files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 20:05:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729587#M537615</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-09-30T20:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729588#M537616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked with a slight modification. Below is what I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( Gender='F',&amp;nbsp; (sum(&amp;nbsp; total &amp;lt;Grade&amp;gt; [Avg Rt]) - sum([Avg Rt]))/(count(total&amp;lt;Grade&amp;gt; [Unique ID]) - count( total &amp;lt;Grade,Gender&amp;gt; [Unique ID])) , avg([Avg Rt]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unique ID was just another field I had but probably could have used any field in place for that count. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your formula worked if there were an equal number of people by gender. I was able to get the counts of each gender so that the sum total was divided by the number of 'M' to get the average for the 'M'. This may have been taking a longer way than needed to solve the problem but it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help! Greatly Appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 20:51:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729588#M537616</guid>
      <dc:creator />
      <dc:date>2014-09-30T20:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Return calculated value from pivot for set dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729589#M537617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great. Kindly close out the thread with the correct/helpful messages.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 20:56:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-calculated-value-from-pivot-for-set-dimension/m-p/729589#M537617</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-09-30T20:56:13Z</dc:date>
    </item>
  </channel>
</rss>

