<?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: RangeAvg(Above not working in a line chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485580#M101287</link>
    <description>&lt;P&gt;Hi, the runnign average could be esasily calculated usiong the expression modifers, as:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_0-1728299223015.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172571iDEF2BEA296C8787F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_0-1728299223015.png" alt="rubenmarin_0-1728299223015.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I see there are days without data, should this days without data to be counted as 0 or just skipped from the average?&lt;/P&gt;
&lt;P&gt;Note that when you use Above(...7) it will get the previous 7 values, which may not be the last 7 days as if there are skipped days, the last 7 values will go beyond those 7 days.&lt;/P&gt;
&lt;P&gt;Having that in mind I would try to get the precalculated accumulated values in script, also the number of values used in that accumulation or a fixed '7' if skipped dates should count as zero.&lt;/P&gt;
&lt;P&gt;Then the expression will be only the division between the accumulated and the number of days used for that date accumulation. this has many advantages, like performance ansd also you don't needd a chart with at least 7 valus to get the rolling avg, you can pick any date or arange of date and you will get the polling avg from the first point of data.&lt;/P&gt;
&lt;P&gt;If there are many selections to by applied and the rolling avg should use them, maybe the solution is to use a similar scenario to an asofcalendar (&lt;A href="https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130&lt;/A&gt;) so each date can access the last 7 days data, allowing them to be calculated on execution time, without the need of precalculated accumulations.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2024 11:13:23 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2024-10-07T11:13:23Z</dc:date>
    <item>
      <title>RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485400#M101265</link>
      <description>&lt;P&gt;Hello Qlik Community,&lt;/P&gt;
&lt;P&gt;I can't seem to get the RangeAvg(Above working in a line chart, it is reporting lower numbers than expected and what is reported in a straight table.&amp;nbsp; No problem using the RangeAvg(Above in a straight table.&lt;/P&gt;
&lt;P&gt;The variable vMeasureSelector3 is made up of numerous master measures, one example is "OFD" which is this expression: Num(Count(if(StopTypeCode='D', StopNum)), '#,##0')&lt;/P&gt;
&lt;P&gt;Here is the expression:&lt;/P&gt;
&lt;P&gt;IF(&lt;BR /&gt;vAggregationType = 'Daily',&lt;BR /&gt;[$(vMeasureSelector3)], &lt;BR /&gt;IF(&lt;BR /&gt;vAggregationType = 'Rolling Average - 7',&lt;BR /&gt;RangeAvg(&lt;BR /&gt;Above([$(vMeasureSelector3)], 0, 7)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks/Mike&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:51:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485400#M101265</guid>
      <dc:creator>ASC-Mike</dc:creator>
      <dc:date>2024-10-04T15:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485464#M101273</link>
      <description>&lt;P&gt;Hi, maybe adding a TOTAL:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IF(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;vAggregationType = 'Daily',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[$(vMeasureSelector3)],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IF(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;vAggregationType = 'Rolling Average - 7',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RangeAvg(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Above(&lt;STRONG&gt;TOTAL&lt;/STRONG&gt; [$(vMeasureSelector3)], 0, 7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If doesn't works, you can upload a sample app (with some dummy data in an inline table) that demonstrates the issue so we can take a look.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2024 06:45:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485464#M101273</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2024-10-06T06:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485494#M101277</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I stripped down the entire app and left just what is needed, using the same data that is in the SQL tables for the OFD (Stops).&amp;nbsp; App is attached.&lt;/P&gt;
&lt;P&gt;This is what it should look like for the rolling 7, the first was output using python from the same data, the second is from a tableau app with same data.&amp;nbsp; The first line should all be in the mid to upper 200s.&lt;/P&gt;
&lt;P&gt;Thanks/Mike&lt;/P&gt;
&lt;DIV id="tinyMceEditor_148a355d6f275eASCMike_7" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ASCMike_8-1728242609260.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172552iCDC52B6009B81A4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ASCMike_8-1728242609260.png" alt="ASCMike_8-1728242609260.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ASCMike_6-1728242312591.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172550i14568035B8C2DF44/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ASCMike_6-1728242312591.png" alt="ASCMike_6-1728242312591.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2024 19:23:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485494#M101277</guid>
      <dc:creator>ASC-Mike</dc:creator>
      <dc:date>2024-10-06T19:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485580#M101287</link>
      <description>&lt;P&gt;Hi, the runnign average could be esasily calculated usiong the expression modifers, as:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_0-1728299223015.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172571iDEF2BEA296C8787F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_0-1728299223015.png" alt="rubenmarin_0-1728299223015.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I see there are days without data, should this days without data to be counted as 0 or just skipped from the average?&lt;/P&gt;
&lt;P&gt;Note that when you use Above(...7) it will get the previous 7 values, which may not be the last 7 days as if there are skipped days, the last 7 values will go beyond those 7 days.&lt;/P&gt;
&lt;P&gt;Having that in mind I would try to get the precalculated accumulated values in script, also the number of values used in that accumulation or a fixed '7' if skipped dates should count as zero.&lt;/P&gt;
&lt;P&gt;Then the expression will be only the division between the accumulated and the number of days used for that date accumulation. this has many advantages, like performance ansd also you don't needd a chart with at least 7 valus to get the rolling avg, you can pick any date or arange of date and you will get the polling avg from the first point of data.&lt;/P&gt;
&lt;P&gt;If there are many selections to by applied and the rolling avg should use them, maybe the solution is to use a similar scenario to an asofcalendar (&lt;A href="https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130&lt;/A&gt;) so each date can access the last 7 days data, allowing them to be calculated on execution time, without the need of precalculated accumulations.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 11:13:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485580#M101287</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2024-10-07T11:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485590#M101291</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/232277"&gt;@ASC-Mike&lt;/a&gt;&amp;nbsp; try below expression&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;IF(
    vAggregationType = 'Daily',
    [$(vMeasureSelection)], 
    IF(
        vAggregationType = 'Rolling Average - 7',
       sum(aggr(RangeAvg(Above([$(vMeasureSelection)], 0, 7)),[$(vDimensionSelection)],(Date,(NUMERIC))))
    )
)

 &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Oct 2024 12:30:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485590#M101291</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-07T12:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485624#M101297</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp; Thanks that worked.&amp;nbsp; I similar variations using sum and aggr but clearly not as your solution.&amp;nbsp; Thanks again.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 14:00:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485624#M101297</guid>
      <dc:creator>ASC-Mike</dc:creator>
      <dc:date>2024-10-07T14:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg(Above not working in a line chart</title>
      <link>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485627#M101298</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/232277"&gt;@ASC-Mike&lt;/a&gt;&amp;nbsp; Sorting date within Aggr is the key here.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 14:02:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/RangeAvg-Above-not-working-in-a-line-chart/m-p/2485627#M101298</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-07T14:02:46Z</dc:date>
    </item>
  </channel>
</rss>

