<?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: Latest 4 week rolling value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Latest-4-week-rolling-value/m-p/2526241#M107163</link>
    <description>&lt;P&gt;you can try to handle this through the load editor. Below is a sample code. here if the sales is 0, then we will take the last sales amount and show in Qlik Sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hierarchy:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;WeekEnding, LatestSales&lt;BR /&gt;02-12-2024, 15&lt;BR /&gt;09-12-2024, 0&lt;BR /&gt;16-12-2024, 7&lt;BR /&gt;23-12-2024, 0&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;FinalLoad:&lt;BR /&gt;Load&lt;BR /&gt;WeekEnding,&lt;BR /&gt;LatestSales,&lt;BR /&gt;If(LatestSales = 0, Peek(MeasureOutput), LatestSales) as MeasureOutput&lt;/P&gt;&lt;P&gt;Resident Hierarchy;&lt;BR /&gt;Drop table Hierarchy;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Aug 2025 07:53:44 GMT</pubDate>
    <dc:creator>Kaushik2020</dc:creator>
    <dc:date>2025-08-05T07:53:44Z</dc:date>
    <item>
      <title>Latest 4 week rolling value</title>
      <link>https://community.qlik.com/t5/App-Development/Latest-4-week-rolling-value/m-p/2522328#M106652</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I have a expression that calculates the latest sales value by customer and brand in a particular period. What I need now is to use this expression, and calculate all the latest values by customer and brand within a 4 week rolling period.&lt;/P&gt;
&lt;P&gt;Below is the result I need&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rworthmann681_0-1750863757418.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181629i65F758D97902BD94/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rworthmann681_0-1750863757418.png" alt="rworthmann681_0-1750863757418.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have tried various options, but it always only accumulates.&amp;nbsp; This would be ideal, just if there is another option than RangeSum&lt;BR /&gt;&lt;BR /&gt;Count({1&amp;lt;[Week Ending]={"&amp;gt;=$(=Min([Week Ending]))&amp;lt;=$(=Max([Week Ending]))"}&amp;gt;} DISTINCT 1) *&lt;BR /&gt;RangeSum(Above(Sum({1}0) + LatestAvailNP, 0, 4)).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my initial expression that calculates the LatestAvailNP measure:&lt;/P&gt;
&lt;P&gt;// Define a variable to detect which time field is present&lt;BR /&gt;If(&lt;BR /&gt;WildMatch(GetObjectField(0), 'Date') &lt;BR /&gt;or WildMatch(GetObjectField(1), 'Date') &lt;BR /&gt;or WildMatch(GetObjectField(2), 'Date'),&lt;/P&gt;
&lt;P&gt;// Date is in use&lt;BR /&gt;If(&lt;BR /&gt;Dimensionality() = 0,&lt;BR /&gt;// Total row&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name]&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], NumDate&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;// Row level&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name], Date&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], Date, NumDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;// Week Ending in use&lt;BR /&gt;If(&lt;BR /&gt;WildMatch(GetObjectField(0), 'Week Ending') &lt;BR /&gt;or WildMatch(GetObjectField(1), 'Week Ending') &lt;BR /&gt;or WildMatch(GetObjectField(2), 'Week Ending'),&lt;/P&gt;
&lt;P&gt;If(&lt;BR /&gt;Dimensionality() = 0,&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name]&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], NumDate&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name], [Week Ending]&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], [Week Ending], NumDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;// Period in use&lt;BR /&gt;If(&lt;BR /&gt;WildMatch(GetObjectField(0), 'Period') &lt;BR /&gt;or WildMatch(GetObjectField(1), 'Period') &lt;BR /&gt;or WildMatch(GetObjectField(2), 'Period'),&lt;/P&gt;
&lt;P&gt;If(&lt;BR /&gt;Dimensionality() = 0,&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name]&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], NumDate&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name], Period&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], Period, NumDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;// Default: no time field detected&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr(&lt;BR /&gt;If(&lt;BR /&gt;NumDate = Max(TOTAL &amp;lt;CUST_CD, [Brand Name]&amp;gt; NumDate),&lt;BR /&gt;Sum(AVAIL)&lt;BR /&gt;),&lt;BR /&gt;CUST_CD, [Brand Name], NumDate&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;Please help!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 05:32:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Latest-4-week-rolling-value/m-p/2522328#M106652</guid>
      <dc:creator>rworthmann681</dc:creator>
      <dc:date>2025-06-27T05:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Latest 4 week rolling value</title>
      <link>https://community.qlik.com/t5/App-Development/Latest-4-week-rolling-value/m-p/2526241#M107163</link>
      <description>&lt;P&gt;you can try to handle this through the load editor. Below is a sample code. here if the sales is 0, then we will take the last sales amount and show in Qlik Sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hierarchy:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;WeekEnding, LatestSales&lt;BR /&gt;02-12-2024, 15&lt;BR /&gt;09-12-2024, 0&lt;BR /&gt;16-12-2024, 7&lt;BR /&gt;23-12-2024, 0&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;FinalLoad:&lt;BR /&gt;Load&lt;BR /&gt;WeekEnding,&lt;BR /&gt;LatestSales,&lt;BR /&gt;If(LatestSales = 0, Peek(MeasureOutput), LatestSales) as MeasureOutput&lt;/P&gt;&lt;P&gt;Resident Hierarchy;&lt;BR /&gt;Drop table Hierarchy;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2025 07:53:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Latest-4-week-rolling-value/m-p/2526241#M107163</guid>
      <dc:creator>Kaushik2020</dc:creator>
      <dc:date>2025-08-05T07:53:44Z</dc:date>
    </item>
  </channel>
</rss>

