<?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 Aggr using unknown values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-using-unknown-values/m-p/1766231#M454294</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to calculate the mean moving range. The consensus across this forum suggests that an expression along the lines of&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Avg&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;total&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;aggr&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;fabs&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum(Sales&lt;/SPAN&gt;&lt;SPAN&gt;)-&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;below&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(Sales&lt;/SPAN&gt;&lt;SPAN&gt;))),Date&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt; will do the trick.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This didn't appear to be working for me, and after a lot of head scratching it appears that it's down to my Aggr using values which I'm unsure where they've been obtained from.&lt;/P&gt;&lt;P&gt;Below is the table with the expressions used. It calculates the daily total correctly, the following day's total correctly, and the moving range correctly. However, the&amp;nbsp;mean moving range is incorrect. Alongside the table is the values held in Aggr which I've used to try and pinpoint where the issue is. It looks like it stores the right values for the first couple of bits but when it subtracts one from the other it comes out with completely different results (There is a 9 in Aggr but not in the data table for example)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data table" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45215i478A200DE91F9B6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Qlik forum post.png" alt="Data table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Data table&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've come to a conclusion that there's an issue with my expression which might be related to using DISTINCT?&lt;/P&gt;&lt;P&gt;Loading the data into another app and using the expression&amp;nbsp;&lt;FONT color="#0000FF"&gt;Avg(total aggr(fabs(Patients- below(Patients)),Date))&lt;/FONT&gt; gives the expected outcome&lt;/P&gt;&lt;P&gt;Based on that I can only assume that I'm missing something from my expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Avg(total aggr(fabs(COUNT( DISTINCT Patient_ID )- below(COUNT(DISTINCT Patient_ID ))),ActDate))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Any ideas?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Edit: I've attached a qvw with data in. I've stripped it to only include 2 columns, and bizarrely&amp;nbsp;&lt;/FONT&gt;every time I reload the app the values in the Aggr change. The COUNT values in the table do not change, the values in the fabs expression do not change, only the values held in Aggr change. They don't total the same on each reload. Should I not be using ActDate in the Aggr() (even though that is the dimension I'm using in the table?)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 17:44:47 GMT</pubDate>
    <dc:creator>BertieBott</dc:creator>
    <dc:date>2024-11-16T17:44:47Z</dc:date>
    <item>
      <title>Aggr using unknown values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-using-unknown-values/m-p/1766231#M454294</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to calculate the mean moving range. The consensus across this forum suggests that an expression along the lines of&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Avg&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;total&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;aggr&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;fabs&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum(Sales&lt;/SPAN&gt;&lt;SPAN&gt;)-&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;below&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(Sales&lt;/SPAN&gt;&lt;SPAN&gt;))),Date&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt; will do the trick.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This didn't appear to be working for me, and after a lot of head scratching it appears that it's down to my Aggr using values which I'm unsure where they've been obtained from.&lt;/P&gt;&lt;P&gt;Below is the table with the expressions used. It calculates the daily total correctly, the following day's total correctly, and the moving range correctly. However, the&amp;nbsp;mean moving range is incorrect. Alongside the table is the values held in Aggr which I've used to try and pinpoint where the issue is. It looks like it stores the right values for the first couple of bits but when it subtracts one from the other it comes out with completely different results (There is a 9 in Aggr but not in the data table for example)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data table" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45215i478A200DE91F9B6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Qlik forum post.png" alt="Data table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Data table&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've come to a conclusion that there's an issue with my expression which might be related to using DISTINCT?&lt;/P&gt;&lt;P&gt;Loading the data into another app and using the expression&amp;nbsp;&lt;FONT color="#0000FF"&gt;Avg(total aggr(fabs(Patients- below(Patients)),Date))&lt;/FONT&gt; gives the expected outcome&lt;/P&gt;&lt;P&gt;Based on that I can only assume that I'm missing something from my expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Avg(total aggr(fabs(COUNT( DISTINCT Patient_ID )- below(COUNT(DISTINCT Patient_ID ))),ActDate))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Any ideas?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Edit: I've attached a qvw with data in. I've stripped it to only include 2 columns, and bizarrely&amp;nbsp;&lt;/FONT&gt;every time I reload the app the values in the Aggr change. The COUNT values in the table do not change, the values in the fabs expression do not change, only the values held in Aggr change. They don't total the same on each reload. Should I not be using ActDate in the Aggr() (even though that is the dimension I'm using in the table?)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-using-unknown-values/m-p/1766231#M454294</guid>
      <dc:creator>BertieBott</dc:creator>
      <dc:date>2024-11-16T17:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr using unknown values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-using-unknown-values/m-p/1766662#M454303</link>
      <description>&lt;P&gt;I managed to fix it&lt;/P&gt;&lt;P&gt;Although Count(DISTINCT) was always correct, Below(Count(DISTINCT) was in a different order on each reload.&lt;/P&gt;&lt;P&gt;I needed to order the date in the script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 13:45:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-using-unknown-values/m-p/1766662#M454303</guid>
      <dc:creator>BertieBott</dc:creator>
      <dc:date>2020-12-07T13:45:33Z</dc:date>
    </item>
  </channel>
</rss>

