<?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: Calculating moving average/date order issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530152#M746665</link>
    <description>&lt;P&gt;I am not sure why you think sales is an issue, but if this worked&lt;/P&gt;&lt;PRE&gt;RangeAvg(Above(Sum(sales), 0, 18))&lt;/PRE&gt;&lt;P&gt;I don't see why you think sales is causing the problem.&lt;/P&gt;&lt;P&gt;But having said that, I don't really have a way to test unless you are able to share your app for me to look at.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 18:06:52 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-01-14T18:06:52Z</dc:date>
    <item>
      <title>Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530140#M746660</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to calculate a moving average for a data set with no luck.&lt;/P&gt;&lt;P&gt;I have tried to use the&amp;nbsp;&lt;STRONG&gt;rangeavg(above(sum(sales),0,18)) &lt;/STRONG&gt;code, but have encountered an issue with the date order.&amp;nbsp; It appears to be ordering by the value of the measure rather than by the date order (dimension). This seems to be preventing me from calculating an average (sales value returns zero).&lt;/P&gt;&lt;P&gt;I believe an AGGR function might be able to help here, but not sure exactly how to use it. Is there a way I can wrap the rangeavg formula with an AGGR to make this work? Many Thanks!&lt;/P&gt;&lt;P&gt;This is the data I am working with:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&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D&gt;23&lt;/TD&gt;&lt;TD&gt;2017-02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;2017-04&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;2017-03&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:45:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530140#M746660</guid>
      <dc:creator>tomelmslie</dc:creator>
      <dc:date>2024-11-16T04:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530141#M746661</link>
      <description>&lt;P&gt;If your date is sorted in the script... you can do this&lt;/P&gt;&lt;PRE&gt;Aggr(RangeAvg(Above(Sum(sales), 0, 18)), Date)&lt;/PRE&gt;&lt;P&gt;If it isn't, but you have QV12 or above, you can use this&lt;/P&gt;&lt;PRE&gt;Aggr(RangeAvg(Above(Sum(sales), 0, 18)), (Date, (Numeric)))&lt;/PRE&gt;&lt;P&gt;If your date isn't sorted and you are still using QV11.2 or lower, you will need to make sure that your Date field is sorted in ascending order in the script and then you can use the first expression&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 17:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530141#M746661</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-14T17:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530146#M746662</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I tried both options but no luck - strangely my date order appears correctly now, but the sales column returns zero value for each date point. Might I have a problem with the sales measure in this case?&lt;/P&gt;&lt;P&gt;I am using Qlik Sense 2018 - not sure if this helps...&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 17:49:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530146#M746662</guid>
      <dc:creator>tomelmslie</dc:creator>
      <dc:date>2019-01-14T17:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530147#M746663</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/59959"&gt;@tomelmslie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Qlik Sense 2018 - not sure if this helps...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You posted your question in QlikView section of the community which is what confused me. But if you are using Qlik Sense 2018, you should def. be able to use this&lt;/P&gt;&lt;PRE&gt;Aggr(RangeAvg(Above(Sum(sales), 0, 18)), (Date, (Numeric)))&lt;/PRE&gt;&lt;P&gt;Few things to check if this became 0. Is your Date field called Date or something else? Make sure to use the correct name. Also, does this happen when you make a selection or does it no work with or without selections?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 17:53:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530147#M746663</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-14T17:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530149#M746664</link>
      <description>Apologies for that! The field name is definitely correct. I have tried this in a table as well as different graphs, and each time zero is returned. I have tested the code with other measures other than sales, and it works - I suspect it is an issue with the construction of measure in that case?</description>
      <pubDate>Mon, 14 Jan 2019 18:00:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530149#M746664</guid>
      <dc:creator>tomelmslie</dc:creator>
      <dc:date>2019-01-14T18:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530152#M746665</link>
      <description>&lt;P&gt;I am not sure why you think sales is an issue, but if this worked&lt;/P&gt;&lt;PRE&gt;RangeAvg(Above(Sum(sales), 0, 18))&lt;/PRE&gt;&lt;P&gt;I don't see why you think sales is causing the problem.&lt;/P&gt;&lt;P&gt;But having said that, I don't really have a way to test unless you are able to share your app for me to look at.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 18:06:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530152#M746665</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-14T18:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530348#M746666</link>
      <description>I played around with the formula and RangeAvg(Above(Count(Sales), 0, 18)) seems to have done the trick which is strange!</description>
      <pubDate>Tue, 15 Jan 2019 10:10:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530348#M746666</guid>
      <dc:creator>tomelmslie</dc:creator>
      <dc:date>2019-01-15T10:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating moving average/date order issue</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530414#M746667</link>
      <description>&lt;P&gt;Good to know &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 11:56:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-moving-average-date-order-issue/m-p/1530414#M746667</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-15T11:56:16Z</dc:date>
    </item>
  </channel>
</rss>

