<?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: Using RangeSum and Aggr with 3 dimensions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20629#M3433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not easy to say without deeper insights in your datamodel how it could be solved and which way would be the most elegant. Personally I use for such things a flag within the master-calendar which is 0 or 1 and which I could just aggregate with a sum-function to get the number of working days for the used selection. This could then be used in a logic like sum(value) / sum(workingdayFlag) to get the appropriate average.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way of using this flag is as condition within the set analysis, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... workingdayFlag = {1} ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereby in your case you might need this condition within the inner- and the outer-aggregation. This meant to apply it in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;sum({&amp;lt; workingdayFlag = {1} &amp;gt;} aggr(sum({&amp;lt; workingdayFlag = {1} ...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More to this could you find here: &lt;A href="https://community.qlik.com/qlik-blogpost/4669"&gt;Set Analysis in the Aggr function&lt;/A&gt;‌.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 17 Feb 2018 10:54:58 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2018-02-17T10:54:58Z</dc:date>
    <item>
      <title>Using RangeSum and Aggr with 3 dimensions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20626#M3430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good evening all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm hoping someone will be able to help resolve a conundrum I currently have....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm successfully using the below expression to calculate a daily value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vMaxStockMovementDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; -={'0'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;transaction_type&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={'COMP','DKIT','RWRK'} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;movement_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;usage_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHComponent&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHProduct&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&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;I'm now looking to apply a rolling average calculation to this using RangeSum and above where vRollingDays is a variable set by a slider (so the user can determine over how many days they want to average the data).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RangeAvg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vMaxStockMovementDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; -={'0'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;transaction_type&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={'COMP','DKIT','RWRK'} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;movement_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;usage_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),0,&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vRollingDays&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHComponent&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHProduct, &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&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;I can't get this to work, nor can I understand the output, however when I've used this structure before but with a single dimension in the aggr it works perfectly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Any help would be greatly appreciated,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Feb 2018 21:18:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20626#M3430</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-13T21:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using RangeSum and Aggr with 3 dimensions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20627#M3431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it should rather look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;RangeAvg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vMaxStockMovementDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; -={'0'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;transaction_type&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ={'COMP','DKIT','RWRK'} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;movement_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;usage_quantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;labour_cost&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHComponent&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%WHProduct&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ReportingDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;,0,$(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;vRollingDays&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2018 12:37:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20627#M3431</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-02-14T12:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using RangeSum and Aggr with 3 dimensions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20628#M3432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcus, that seems to have done the trick in terms of calculating correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It has thrown out an additional issue....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the date field (ReportingDate) contains data for 5 days rather than 7 in a week (i.e. no data over a weekend), and now the average is taking the blank days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/193483_pastedImage_1.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/193482_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anyway to remove this? I assume not as 'ReportingDate' comes from a calendar that includes all dates in the year, and the above calculation includes all dates, not just those with values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Feb 2018 10:45:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20628#M3432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-15T10:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using RangeSum and Aggr with 3 dimensions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20629#M3433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not easy to say without deeper insights in your datamodel how it could be solved and which way would be the most elegant. Personally I use for such things a flag within the master-calendar which is 0 or 1 and which I could just aggregate with a sum-function to get the number of working days for the used selection. This could then be used in a logic like sum(value) / sum(workingdayFlag) to get the appropriate average.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way of using this flag is as condition within the set analysis, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... workingdayFlag = {1} ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereby in your case you might need this condition within the inner- and the outer-aggregation. This meant to apply it in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;sum({&amp;lt; workingdayFlag = {1} &amp;gt;} aggr(sum({&amp;lt; workingdayFlag = {1} ...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More to this could you find here: &lt;A href="https://community.qlik.com/qlik-blogpost/4669"&gt;Set Analysis in the Aggr function&lt;/A&gt;‌.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Feb 2018 10:54:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-RangeSum-and-Aggr-with-3-dimensions/m-p/20629#M3433</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-02-17T10:54:58Z</dc:date>
    </item>
  </channel>
</rss>

