<?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: Aggr with data filter in Featured Members</title>
    <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487470#M377</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164382"&gt;@AdminLoghaus&lt;/a&gt;&amp;nbsp; if you want your each product code to be within 45 days independently then set analysis won't work. You will need if condition&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;=sum({&amp;lt;
TransactionType = {'Invoicing'},
BusinessTransaction = {'E-commerce'},
ProductLastEntryDateSite = {"&amp;gt;=$(v.cutStartDate)"}
&amp;gt;}
aggr(if(ProductLastEntryDateSite &amp;gt;= max(total &amp;lt;ProductCode&amp;gt; ProductLastEntryDateSite) and ProductLastEntryDateSite &amp;lt;= max(total &amp;lt;ProductCode&amp;gt;)+45,OrderItemSaleQuantityInvoiced),ProductCode,ProductLastEntryDateSite,ProductYearMonthLastEntrySite))&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 16 Oct 2024 18:42:22 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2024-10-16T18:42:22Z</dc:date>
    <item>
      <title>Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487399#M373</link>
      <description>&lt;P&gt;I need help with this expression. The goal is to calculate within set analysis the field &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt; + 45 days forward. This calculation needs to be done for each product where the field is &lt;EM&gt;ProductCode&lt;/EM&gt;. In other words, each product has a date in the field &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt;. However, in the table, the result will only be displayed based on the field &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt;. Therefore, I need to create a virtual table using the &lt;EM&gt;Aggr&lt;/EM&gt; function to get this result.&lt;/P&gt;
&lt;P&gt;The problem is that when I include the dimension &lt;EM&gt;ProductCode&lt;/EM&gt; in the table, the information appears, and the result is correct. But when I remove the &lt;EM&gt;ProductCode&lt;/EM&gt; dimension and leave only &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt;, the result becomes null. How can I apply date filters within the &lt;EM&gt;Aggr&lt;/EM&gt; function?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Expression:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;ProductYearMonthLastEntrySite&amp;gt;}&lt;BR /&gt;Aggr({&amp;lt;&lt;BR /&gt;Date = {"&amp;gt;=$(=Date(Max(ProductLastEntryDateSite)+0))&amp;lt;=$(=Date(Max(ProductLastEntryDateSite)+45))"}, &lt;BR /&gt;Year = {"&amp;gt;=$(=Year(Max(ProductLastEntryDateSite)+0))&amp;lt;=$(=Year(Max(ProductLastEntryDateSite)+45))"},&lt;BR /&gt;YearMonth = {"&amp;gt;=$(=MonthName(Max(ProductLastEntryDateSite)+0))&amp;lt;=$(=MonthName(Max(ProductLastEntryDateSite)+45))"}&amp;gt;}&lt;BR /&gt;Sum({&amp;lt;&lt;BR /&gt;TransactionType = {'Invoicing'},&lt;BR /&gt;BusinessTransaction = {'E-commerce'},&lt;BR /&gt;ProductLastEntryDateSite = {"&amp;gt;=$(v.cutStartDate)"}&lt;BR /&gt;&amp;gt;} &lt;BR /&gt;OrderItemSaleQuantityInvoiced),ProductYearMonthLastEntrySite))&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdminLoghaus_0-1729087657256.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/173029iD2902E487C729B4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdminLoghaus_0-1729087657256.png" alt="AdminLoghaus_0-1729087657256.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdminLoghaus_1-1729087666862.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/173030i954859BA497D39F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdminLoghaus_1-1729087666862.png" alt="AdminLoghaus_1-1729087666862.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 14:07:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487399#M373</guid>
      <dc:creator>AdminLoghaus</dc:creator>
      <dc:date>2024-10-16T14:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487409#M374</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164382"&gt;@AdminLoghaus&lt;/a&gt;&amp;nbsp; I think you don't need set for Year &amp;amp; YearMonth as you only required it for next 45 days&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Sum({&amp;lt;Date = {"&amp;gt;=$(=Date(Max(ProductLastEntryDateSite)+0))&amp;lt;=$(=Date(Max(ProductLastEntryDateSite)+45))"}&amp;gt;}
Aggr(
Sum({&amp;lt;
TransactionType = {'Invoicing'},
BusinessTransaction = {'E-commerce'},
ProductLastEntryDateSite = {"&amp;gt;=$(v.cutStartDate)"}
&amp;gt;}OrderItemSaleQuantityInvoiced),
ProductYearMonthLastEntrySite))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Oct 2024 14:36:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487409#M374</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-16T14:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487448#M375</link>
      <description>&lt;P&gt;Right. I used your suggested measure, but the result is larger than it should be. My issue is applying the filter within the set analysis or through aggregation so that it applies the 45-day date filter for each &lt;EM&gt;ProductCode&lt;/EM&gt; that I have in the structure as a dimension. In other words, when I add the &lt;EM&gt;ProductCode&lt;/EM&gt; dimension to the table, the result is accurate. However, I can't keep this dimension in the table because my indicator needs to be opened only by Date, and the measure I'm trying to create uses aggregation functions. So, something is missing to filter the date range at the level of each &lt;EM&gt;ProductCode&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:23:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487448#M375</guid>
      <dc:creator>AdminLoghaus</dc:creator>
      <dc:date>2024-10-16T16:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487456#M376</link>
      <description>&lt;P&gt;Complementing my difficulty. Where in this measurement do I add the filter for the ProductCode dimension? I tried this way in the image, but it doesn't work.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdminLoghaus_0-1729097787873.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/173042i38190D1504FD8361/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdminLoghaus_0-1729097787873.png" alt="AdminLoghaus_0-1729097787873.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 16:57:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487456#M376</guid>
      <dc:creator>AdminLoghaus</dc:creator>
      <dc:date>2024-10-16T16:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487470#M377</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164382"&gt;@AdminLoghaus&lt;/a&gt;&amp;nbsp; if you want your each product code to be within 45 days independently then set analysis won't work. You will need if condition&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;=sum({&amp;lt;
TransactionType = {'Invoicing'},
BusinessTransaction = {'E-commerce'},
ProductLastEntryDateSite = {"&amp;gt;=$(v.cutStartDate)"}
&amp;gt;}
aggr(if(ProductLastEntryDateSite &amp;gt;= max(total &amp;lt;ProductCode&amp;gt; ProductLastEntryDateSite) and ProductLastEntryDateSite &amp;lt;= max(total &amp;lt;ProductCode&amp;gt;)+45,OrderItemSaleQuantityInvoiced),ProductCode,ProductLastEntryDateSite,ProductYearMonthLastEntrySite))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Oct 2024 18:42:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487470#M377</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-16T18:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487480#M378</link>
      <description>&lt;P&gt;I used your measure, but it didn’t achieve the desired result. Even so, I took your measure and adjusted it for the situation I need.&lt;/P&gt;
&lt;P&gt;The field &lt;EM&gt;Data&lt;/EM&gt; in the script structure belongs to the same table as the field ItemOrderSaleQuantityInvoiced, so what I actually need is for the &lt;EM&gt;Data&lt;/EM&gt; field to be equal to &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt;, and also for the &lt;EM&gt;Data&lt;/EM&gt; field to equal &lt;EM&gt;ProductLastEntryDateSite&lt;/EM&gt; + 45, in order to get the correct result.&lt;/P&gt;
&lt;P&gt;In my simple table, where I'm showing my indicator, it should only display based on the field &lt;EM&gt;ProductYearMonthLastEntryDateSite&lt;/EM&gt; and the measure we are trying to build. I appreciate the help once again.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;ProductYearMonthLastEntryDateSite&amp;gt;}
Aggr(
sum({&amp;lt;
TransactionType = {'Invoicing'},
BusinessTransaction = {'E-commerce'},
ProductLastEntryDateSite = {"&amp;gt;=$(v.cutStartDate)"}
&amp;gt;}
aggr(if(Data &amp;gt;= Max(&amp;lt;ProductCode&amp;gt;ProductLastEntryDateSite)
and Data &amp;lt;= Max(&amp;lt;ProductCode&amp;gt;ProductLastEntryDateSite) + 45,
ItemOrderSaleQuantityInvoiced), ProductCode)), ProductYearMonthLastEntryDateSite))

&lt;/LI-CODE&gt;
&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 20:07:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487480#M378</guid>
      <dc:creator>AdminLoghaus</dc:creator>
      <dc:date>2024-10-16T20:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with data filter</title>
      <link>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487588#M379</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164382"&gt;@AdminLoghaus&lt;/a&gt;&amp;nbsp; It will be hard to suggest anything without looking at data model and sample data. But idea here is that you need to understand the different level of your filter and aggregation and formulate the measure accordingly&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 08:43:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Featured-Members/Aggr-with-data-filter/m-p/2487588#M379</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-17T08:43:34Z</dc:date>
    </item>
  </channel>
</rss>

