<?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: Previous 3 Moths Dynamic Set Analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484860#M101185</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/174841"&gt;@CalvinTosen&lt;/a&gt;&amp;nbsp; make sure that you are using correct field names for Sales, Product and Dates. Is your measure giving any error? Please share screenshot of your measure&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2024 11:02:27 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2024-10-02T11:02:27Z</dc:date>
    <item>
      <title>Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484831#M101175</link>
      <description>&lt;P&gt;Hi Everyone.&lt;/P&gt;
&lt;P&gt;I would appreciate any assistance with this expression.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I need to calculate the sales for each product three months before the product's last procurement date.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Sum({&amp;lt;Transaction_Date={"&amp;gt;=$(=MonthStart(Max([Pro_Date]), -3))&amp;lt;=$(=MonthEnd(Max([Pro_Date]), -1))"}&amp;gt;} [LINE.NETT.VALUE] )&lt;/P&gt;
&lt;P&gt;This works when 1 product code is selected but when multiple product codes are selected it uses the highest max(Pro_Date) for each product code.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Apologies I'm not allowed to show the sales values" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172427i8DF101F8723D2BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 102559.png" alt="Apologies I'm not allowed to show the sales values" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Apologies I'm not allowed to show the sales values&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Apologies I am not allowed to post the sales values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;In this case, instead of calculating three months back from 2023/05/16 for product code 490843, it's calculating the previous three months from 2024/09/04 for both of them.&lt;BR /&gt;&lt;BR /&gt;If anyone has any solutions it would be greatly appreciated and if any more information is required please let me know, I can provide dummy data if its required.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 08:38:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484831#M101175</guid>
      <dc:creator>CalvinTosen</dc:creator>
      <dc:date>2024-10-02T08:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484845#M101179</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/174841"&gt;@CalvinTosen&lt;/a&gt;&amp;nbsp; Set analysis works once per chart. It doesn't calculated row by row. Hence, it will not consider max values for individual product but max from all product. Try below expression&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;sum({&amp;lt;[LINE.NETT.VALUE]  = {"=aggr(Transaction_Date &amp;gt;= monthstart(max(total &amp;lt;Product&amp;gt;[Pro_Date]),-3) and [Transaction_Date &amp;lt;= monthend(max(total &amp;lt;Product&amp;gt;[Pro_Date]) ,-1),Product, Transaction_Date)"}&amp;gt;}[LINE.NETT.VALUE])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 09:28:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484845#M101179</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-02T09:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484859#M101184</link>
      <description>&lt;P&gt;Hi Kushal&lt;/P&gt;
&lt;P&gt;Thank you so much for replying.&lt;BR /&gt;&lt;BR /&gt;Unfortunatly is does not seem to be working, it is giving 0 values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 10:59:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484859#M101184</guid>
      <dc:creator>CalvinTosen</dc:creator>
      <dc:date>2024-10-02T10:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484860#M101185</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/174841"&gt;@CalvinTosen&lt;/a&gt;&amp;nbsp; make sure that you are using correct field names for Sales, Product and Dates. Is your measure giving any error? Please share screenshot of your measure&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 11:02:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484860#M101185</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-02T11:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484869#M101189</link>
      <description>&lt;P&gt;Field Names are [Product Code no Branch] for the products&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [LINE.NETT.VALUE] for the Sales&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Transaction_Date for the Sales Dates&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Pro_Date for the procurement date&lt;BR /&gt;Original measure&amp;nbsp;&lt;BR /&gt;Sum({&amp;lt;Transaction_Date={"&amp;gt;=$(=MonthStart(Max([Pro_Date]), -3))&amp;lt;=$(=MonthEnd(Max([Pro_Date]), -1))"}&amp;gt;} [LINE.NETT.VALUE] )&lt;BR /&gt;&lt;BR /&gt;Proposed solution with field name changes&lt;BR /&gt;sum({&amp;lt;[LINE.NETT.VALUE] = {'=aggr(Transaction_Date &amp;gt;= monthstart(max(total &amp;lt;[Product Code No Branch]&amp;gt;[Pro_Date]),-3) and [Transaction_Date &amp;lt;= monthend(max(total &amp;lt;[Product Code No Branch]&amp;gt;[Pro_Date]) ,-1),[Product Code No Branch], Transaction_Date)'}&amp;gt;}[LINE.NETT.VALUE])&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="The proposed solution" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172431iA1301983A29C5EE9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 131627.png" alt="The proposed solution" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;The proposed solution&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="The original" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172432i328947FFC1FD2B03/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 131547.png" alt="The original" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;The original&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Let me know if you require anything else&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 11:24:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484869#M101189</guid>
      <dc:creator>CalvinTosen</dc:creator>
      <dc:date>2024-10-02T11:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484871#M101191</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/174841"&gt;@CalvinTosen&lt;/a&gt;&amp;nbsp; It seems you are using procurement date in dimension so you might need to add that as well in aggr function. If it doesn't work please share sample data with expected output&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;sum({&amp;lt;[LINE.NETT.VALUE]  = {"=aggr(Transaction_Date &amp;gt;= monthstart(max(total &amp;lt;Product&amp;gt;[Pro_Date]),-3) and [Transaction_Date &amp;lt;= monthend(max(total &amp;lt;Product&amp;gt;[Pro_Date]) ,-1),Product, Transaction_Date,[Pro_Date])"}&amp;gt;}[LINE.NETT.VALUE])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 11:31:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484871#M101191</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-02T11:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484877#M101193</link>
      <description>&lt;P&gt;My apologies for taking so long Kushal I quickly made a dummy app.&amp;nbsp;&lt;BR /&gt;I marked where it is currently summing the LINE.NETT.AMOUNT for both product codes since 490930's latest Pro_Date is in September and I marked in Green the values that&amp;nbsp;490843 is supposed to use. Hope this Helps&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-02 140838.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172434i5CF72DED48B17907/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-02 140838.png" alt="Screenshot 2024-10-02 140838.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 12:13:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484877#M101193</guid>
      <dc:creator>CalvinTosen</dc:creator>
      <dc:date>2024-10-02T12:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484884#M101195</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/174841"&gt;@CalvinTosen&lt;/a&gt;&amp;nbsp; Can you share demo app? Without looking at data model it will be hard to say what's wrong&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 12:57:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484884#M101195</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-02T12:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Previous 3 Moths Dynamic Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484887#M101196</link>
      <description>&lt;P&gt;Hi Kushal&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I believe I found a solution this expression seems to be working:&lt;BR /&gt;&lt;BR /&gt;Sum(&lt;BR /&gt;Aggr( nodistinct &lt;BR /&gt;If(&lt;BR /&gt;[Transaction_Date] &amp;gt;= MonthStart(Max(TOTAL &amp;lt;[Product Code No Branch]&amp;gt; [Pro_Date]), -3) &lt;BR /&gt;and [Transaction_Date] &amp;lt;= MonthEnd(Max(TOTAL &amp;lt;[Product Code No Branch]&amp;gt; [Pro_Date]), -1), &lt;BR /&gt;[LINE.NETT.VALUE]&lt;BR /&gt;),&lt;BR /&gt;[Product Code No Branch], [Transaction_Date],[DOC.NO]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;Thank you so much for the assistance without your expression I would never have thought of the idea to use Aggr like this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The [DOC.NO] is the invoice number that allows it to use duplicate [LINE.NETT.VALUE]s .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 13:02:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-3-Moths-Dynamic-Set-Analysis/m-p/2484887#M101196</guid>
      <dc:creator>CalvinTosen</dc:creator>
      <dc:date>2024-10-02T13:02:55Z</dc:date>
    </item>
  </channel>
</rss>

