<?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: Please help me modify my Cumulative Sum by Week set expression so it will work with parameters in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2059692#M86977</link>
    <description>&lt;P&gt;I'm attaching a QVF file with limited data in case anyone wants to take a look at what I've got so far.&amp;nbsp; As you can see, if you set the DateFlag_SixWeek to '1' and the CommodityCode to 'LTC', the data looks fine.&amp;nbsp; And, although I've got the set expression set the same way, removing the filters from the filter pane results in incorrect results.&lt;/P&gt;
&lt;P&gt;Hopefully someone can help with this!&amp;nbsp; Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 15:32:49 GMT</pubDate>
    <dc:creator>mikegrattan</dc:creator>
    <dc:date>2023-04-12T15:32:49Z</dc:date>
    <item>
      <title>Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2053801#M86592</link>
      <description>&lt;P&gt;Please help me figure out the set expression below.&lt;/P&gt;
&lt;P&gt;I have the following expression which is working, as long as I am manually selecting a CommodityCode and a DateFlag. It does not work by itself at this point, even though I am specifying the correct filters in the set expression.&lt;/P&gt;
&lt;P&gt;What I would like to do is modify the expression so that it will work for a specific CommodityCode, such as LTC, and a specific DateFlag, such as DateFlag_SixWeeks.&amp;nbsp; The DateFlag_SixWeeks dimension is defined in the data load, and it selects all dates that are prior to the current week - 6 weeks; the value is 1 when true and 0 when false.&lt;/P&gt;
&lt;P&gt;RangeSum(Above(Total (RangeSum(Above( (Aggr(Avg(TOTAL Aggr(Sum({&amp;lt;DateFlag_SixWeek={'1'}, CommodityCode={'LTC'}&amp;gt;} EquivalentQuantity),&lt;BR /&gt;ShipDate,Week)), ShipDate,Week)　) , 0, 6))　) , 0, 6))&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mikegrattan_0-1679948008519.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/103608iB80118B81F1E74A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mikegrattan_0-1679948008519.png" alt="mikegrattan_0-1679948008519.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The table I'm using for this example contains the following columns:&lt;/P&gt;
&lt;P&gt;CommodityCode&lt;BR /&gt;Week&lt;BR /&gt;Avg (cumulative expression above)&lt;/P&gt;
&lt;P&gt;Although ShipDate is not in the table it appears that it is needed in order for the correct accumulation week-over-week.&lt;/P&gt;
&lt;P&gt;I imagine that the set expression,&amp;nbsp;{&amp;lt;DateFlag_SixWeek={1},CommodityCode={'LTC'}&amp;gt;}, needs to be added to the RangeSum and/or Aggr functions but I have not been able to get it to work after trying several variations.&lt;/P&gt;
&lt;P&gt;Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 17:37:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2053801#M86592</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-18T17:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me modify my Cumulative Sum by Week set expression so it will work with parameters</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2059692#M86977</link>
      <description>&lt;P&gt;I'm attaching a QVF file with limited data in case anyone wants to take a look at what I've got so far.&amp;nbsp; As you can see, if you set the DateFlag_SixWeek to '1' and the CommodityCode to 'LTC', the data looks fine.&amp;nbsp; And, although I've got the set expression set the same way, removing the filters from the filter pane results in incorrect results.&lt;/P&gt;
&lt;P&gt;Hopefully someone can help with this!&amp;nbsp; Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 15:32:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2059692#M86977</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-12T15:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2062752#M87161</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;...do you have time to take a look?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 20:37:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2062752#M87161</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-20T20:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2062769#M87165</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49220"&gt;@mikegrattan&lt;/a&gt;&amp;nbsp; without filter you just want to show LTC?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 23:16:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2062769#M87165</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-04-20T23:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063110#M87190</link>
      <description>&lt;P&gt;Hi Kushal.&lt;/P&gt;
&lt;P&gt;Without having to set filters manually, I want to show &lt;SPAN&gt;&amp;nbsp;{&amp;lt;DateFlag_SixWeek={1},CommodityCode={'LTC'}&amp;gt;}.&amp;nbsp; I need the set expression to be part of the overall expression because I want to set up charts that are specific to the last six weeks and for specific commodities.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mikegrattan_0-1682085795634.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/105524iF6982E4C458F250C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mikegrattan_0-1682085795634.png" alt="mikegrattan_0-1682085795634.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 14:03:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063110#M87190</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-21T14:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063138#M87196</link>
      <description>&lt;P&gt;I try something please check the column column AVG TEST. However I do not understant why your number changed for LTC when you pick the value&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 14:36:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063138#M87196</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-21T14:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063158#M87202</link>
      <description>&lt;P&gt;Hi Sabrina.&lt;/P&gt;
&lt;P&gt;Using the IF statement around the RangeSum is an interesting approach and seems like it should work in theory, but for some reason it's not excluding the other commodity codes in the table (not filtering on 'LTC').&amp;nbsp; Also, like you said, it looks like the numbers are not cumulative from the oldest week to the newest week and they appear to be incorrect as well.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate the contribution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 15:02:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063158#M87202</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-21T15:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063165#M87203</link>
      <description>&lt;P&gt;Two ideas :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try to put on the Aggr function, the same fields existing on the set analysis.&lt;/P&gt;
&lt;P&gt;Maybe you can try the if with an aggr ?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 15:09:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063165#M87203</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-21T15:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063195#M87204</link>
      <description>&lt;P&gt;I'm not sure how to go about doing that...I've tried adding another aggr around the whole expression but it's saying it requires two arguments.&amp;nbsp; Sorry, but I get confused with aggr and how it's supposed to work.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 16:14:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063195#M87204</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-21T16:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063261#M87212</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49220"&gt;@mikegrattan&lt;/a&gt;&amp;nbsp; try below expression, I have used set for two Commodity Codes. You can update your set according to your need to include as many Codes you want&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;sum({&amp;lt;DateFlag_SixWeek={1},CommodityCode={'LTC','ARL'}&amp;gt;}
aggr(rangesum(above(total avg(total &amp;lt;CommodityCode,Week&amp;gt;
aggr(Sum({&amp;lt;DateFlag_SixWeek={1},CommodityCode={'LTC','ARL'}&amp;gt;} EquivalentQuantity),CommodityCode,ShipDate_DayOfWeek,Week)),0,6)), CommodityCode, (Week,(NUMERIC,ASCENDING))))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 20:28:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063261#M87212</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-04-21T20:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with RangeSum and set expression</title>
      <link>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063268#M87215</link>
      <description>&lt;P&gt;Wow...yes, that works perfectly.&amp;nbsp; Thank you so much.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 21:33:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Problem-with-RangeSum-and-set-expression/m-p/2063268#M87215</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2023-04-21T21:33:01Z</dc:date>
    </item>
  </channel>
</rss>

