<?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: Different aggregate in the same table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977871#M80712</link>
    <description>&lt;P&gt;Why INST3, LINK1 is showing desired output 'OUT'? That as well falls before 2022/12/31!&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 03:14:09 GMT</pubDate>
    <dc:creator>Digvijay_Singh</dc:creator>
    <dc:date>2022-09-07T03:14:09Z</dc:date>
    <item>
      <title>Different aggregate in the same table</title>
      <link>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977740#M80696</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to check the state of a link within a table based on the date written by the user, the formula is based in Link aggregation, wheras I have to show the instrument granulariti within the same table, a link is out where the sum QT of all&amp;nbsp; it's instruments is 0,&amp;nbsp; &amp;nbsp;here is my data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FACT:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;LINK,INSTRUMENT,QT,%DATE&lt;BR /&gt;1,INST1,5,31/12/2022&lt;BR /&gt;1,INST2,0,30/06/2022&lt;BR /&gt;2,INST1,0,31/12/2022&lt;BR /&gt;2,INST3,0,30/06/2022&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;PS: we are in a star schema, the sample above is just for the fact which is related to other dimensions (LINK,INSTRUMENT...)&lt;/P&gt;
&lt;P&gt;There is the two formulas I use:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;QT:&lt;/STRONG&gt;&amp;nbsp;Sum(aggr(FirstSortedValue(DISTINCT TOTAL&amp;lt;LINK,INSTRUMENT&amp;gt;{&amp;lt;[%DATE]={"&amp;lt;=$(=vDate)"}&amp;gt;} QT,-[%DATE]),LINK,INSTRUMENT))&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;STATE:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;=IF( Sum(aggr(FirstSortedValue(DISTINCT TOTAL&amp;lt;LINK&amp;gt;{&amp;lt;[%DATE]={"&amp;lt;=$(=vDate)"}&amp;gt;} QT,-[%DATE])&lt;BR /&gt;,LINK))=0,'OUT','IN')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMAROUF_0-1662486281105.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/88434i5206D0261B21C700/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMAROUF_0-1662486281105.png" alt="JMAROUF_0-1662486281105.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMAROUF_0-1662539732959.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/88489i0F72543C65AEE57F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMAROUF_0-1662539732959.png" alt="JMAROUF_0-1662539732959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMAROUF_1-1662539791996.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/88490i663CB79425A477D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMAROUF_1-1662539791996.png" alt="JMAROUF_1-1662539791996.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;because the sum QT of link 1 before 2022/12/31 is 5 not 0, so it's state is IN&lt;/P&gt;
&lt;P&gt;Any help please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 09:09:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977740#M80696</guid>
      <dc:creator>JMAROUF</dc:creator>
      <dc:date>2022-09-07T09:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Different aggregate in the same table</title>
      <link>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977871#M80712</link>
      <description>&lt;P&gt;Why INST3, LINK1 is showing desired output 'OUT'? That as well falls before 2022/12/31!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 03:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977871#M80712</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2022-09-07T03:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Different aggregate in the same table</title>
      <link>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977984#M80723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/48860"&gt;@Digvijay_Singh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have corrected the desired outpu and DATAt, I meant LINK2.&lt;/P&gt;
&lt;P&gt;Thanks in advance;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 08:39:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Different-aggregate-in-the-same-table/m-p/1977984#M80723</guid>
      <dc:creator>JMAROUF</dc:creator>
      <dc:date>2022-09-07T08:39:22Z</dc:date>
    </item>
  </channel>
</rss>

