<?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 Total values in pivot table: weighted average in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105309#M7151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a special kind of challenge &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I want to get the following pivot table (see the following example):&lt;/P&gt;&lt;TABLE border="1" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH valign="middle"&gt;Project&lt;/TH&gt;&lt;TD colspan="2"&gt;Total&lt;/TD&gt;&lt;TH colspan="2" valign="middle"&gt;Employees&lt;/TH&gt;&lt;TH colspan="2" valign="middle"&gt;Freelancer&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;11.11%&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;8.03%&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;11.96%&lt;/TD&gt;&lt;TD&gt;10.71%&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;62.73%&lt;/TD&gt;&lt;TD&gt;77.38%&lt;/TD&gt;&lt;TD&gt;59.90%&lt;/TD&gt;&lt;TD&gt;70.50%&lt;/TD&gt;&lt;TD&gt;99.78%&lt;/TD&gt;&lt;TD&gt;98.00%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already found the formula for the columns "Actual": sum(Cost)/ sum(total &amp;lt;Status&amp;gt; Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My challenge now is to find the right formula for the column "Plan" because I want to achieve a weighted average in the total values. I that I want the value of "Employee" count 3 times and "Freelancer" 1 time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: Project B&lt;/P&gt;&lt;P&gt;The plan for employees (70.5) times 3 (=211.5) + plan of freelancer (98) times 1 = 309.5 divided by 4 equals a weighted total average of 77.38.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the project B I already got the fitting formula: &lt;/P&gt;&lt;P&gt;((sum({&amp;lt;Status= {"Employee"} &amp;gt;}distinct Plan)*3) &lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;(sum({&amp;lt;Status= {'Freelancer'} &amp;gt;}distinct Plan)*1)) &lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;(if(Status='Employee',3,&lt;/P&gt;&lt;P&gt;if(Status='Freelancer' ,1,4))) // Divisor depends on in which Status the calculation takes place&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, for Project A I cant make it work. As there are empty or null values in the Status "Freelancer", for the total value the divisor will always equal 3 as it appears there are only employees.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, how can I achieve a division in the total value always by 4? I already tried diverse funktions with isnull but I cant find a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2018 11:19:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-07-19T11:19:02Z</dc:date>
    <item>
      <title>Total values in pivot table: weighted average</title>
      <link>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105309#M7151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a special kind of challenge &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I want to get the following pivot table (see the following example):&lt;/P&gt;&lt;TABLE border="1" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH valign="middle"&gt;Project&lt;/TH&gt;&lt;TD colspan="2"&gt;Total&lt;/TD&gt;&lt;TH colspan="2" valign="middle"&gt;Employees&lt;/TH&gt;&lt;TH colspan="2" valign="middle"&gt;Freelancer&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;TD&gt;Actual&lt;/TD&gt;&lt;TD&gt;Plan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;11.11%&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;8.03%&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;11.96%&lt;/TD&gt;&lt;TD&gt;10.71%&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;62.73%&lt;/TD&gt;&lt;TD&gt;77.38%&lt;/TD&gt;&lt;TD&gt;59.90%&lt;/TD&gt;&lt;TD&gt;70.50%&lt;/TD&gt;&lt;TD&gt;99.78%&lt;/TD&gt;&lt;TD&gt;98.00%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already found the formula for the columns "Actual": sum(Cost)/ sum(total &amp;lt;Status&amp;gt; Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My challenge now is to find the right formula for the column "Plan" because I want to achieve a weighted average in the total values. I that I want the value of "Employee" count 3 times and "Freelancer" 1 time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: Project B&lt;/P&gt;&lt;P&gt;The plan for employees (70.5) times 3 (=211.5) + plan of freelancer (98) times 1 = 309.5 divided by 4 equals a weighted total average of 77.38.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the project B I already got the fitting formula: &lt;/P&gt;&lt;P&gt;((sum({&amp;lt;Status= {"Employee"} &amp;gt;}distinct Plan)*3) &lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;(sum({&amp;lt;Status= {'Freelancer'} &amp;gt;}distinct Plan)*1)) &lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;(if(Status='Employee',3,&lt;/P&gt;&lt;P&gt;if(Status='Freelancer' ,1,4))) // Divisor depends on in which Status the calculation takes place&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, for Project A I cant make it work. As there are empty or null values in the Status "Freelancer", for the total value the divisor will always equal 3 as it appears there are only employees.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, how can I achieve a division in the total value always by 4? I already tried diverse funktions with isnull but I cant find a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2018 11:19:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105309#M7151</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-19T11:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Total values in pivot table: weighted average</title>
      <link>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105310#M7152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;((sum({&amp;lt;Status= {"Employee"} &amp;gt;}distinct Plan)*3)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;+&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;(sum({&amp;lt;Status= {'Freelancer'} &amp;gt;}distinct Plan)*1))&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;/&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;(If(Dimensionality() = 0, 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Status = 'Employee', 3,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Status = 'Freelancer', 1))))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2018 17:25:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105310#M7152</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-19T17:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Total values in pivot table: weighted average</title>
      <link>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105311#M7153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey thank you so much! That was really the right clue. In fact I had to change it to SecondDimensionality() because I needed the total of the columns not the rows but you put me on the right path!&lt;/P&gt;&lt;P&gt;Have a great weekend!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2018 06:53:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Total-values-in-pivot-table-weighted-average/m-p/105311#M7153</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-20T06:53:50Z</dc:date>
    </item>
  </channel>
</rss>

