<?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: Trying to use an AGGR(Max date) with same date in IF expression in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832215#M68671</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/148570"&gt;@stsk&lt;/a&gt;&amp;nbsp; You might have multiple lines for&amp;nbsp;&lt;SPAN&gt;updated_dt for combination of dimension, so you may need to use aggregate function to return single value for combination of dimensions used in aggr.&amp;nbsp; May be try below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;= IF(value = 'UNPLANNED' AND AGGR(COUNT(id + code + year), id + code + year) = 1&lt;BR /&gt;, Today() - &lt;STRONG&gt;AGGR(MAX(updated_dt), id, code, year)&lt;/STRONG&gt;&lt;BR /&gt;, AGGR(MAX(updated_dt), id, code, year) - AGGR(MIN(updated_dt), id, code, year)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can either use Min or Max in highlighted part based on your requirement&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 14:48:45 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2021-08-30T14:48:45Z</dc:date>
    <item>
      <title>Trying to use an AGGR(Max date) with same date in IF expression</title>
      <link>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832202#M68669</link>
      <description>&lt;P&gt;I'm trying to create the following expression using an LOD max-min and a non LOD subtraction on the same date.&amp;nbsp; When I use the non LOD updated_dt in the if the LOD function behaves differently.&amp;nbsp; Below is the expression I'm using and the data that is being returned.&amp;nbsp; Since value = UNPLANNED and &amp;lt;&amp;gt; 1 then the AGGR part of the if should return but it is returning blank, I've put the AGGR expression as a separate field and it works fine.&amp;nbsp; And when I take the "-updated_dt" from the true part of the expression it also works fine.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;= IF(value = 'UNPLANNED' AND AGGR(COUNT(id + code + year), id + code + year) = 1&lt;BR /&gt;, Today() - updated_dt&lt;BR /&gt;, AGGR(MAX(updated_dt), id, code, year) - AGGR(MIN(updated_dt), id, code, year)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;Using Expression above&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;UNPLANNED&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I leave off the updated_dt on the 1st in the TRUE statement of the IF, the AGGR returns as expected.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= IF(value = 'UNPLANNED' AND AGGR(COUNT(id + code + year), id + code + year) = 1&lt;BR /&gt;, Today()&lt;BR /&gt;, AGGR(MAX(updated_dt), id, code, year) - AGGR(MIN(updated_dt), id, code, year)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;UNPLANNED&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something I am missing?&amp;nbsp; Can anyone help?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 14:36:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832202#M68669</guid>
      <dc:creator>stsk</dc:creator>
      <dc:date>2021-08-30T14:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use an AGGR(Max date) with same date in IF expression</title>
      <link>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832215#M68671</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/148570"&gt;@stsk&lt;/a&gt;&amp;nbsp; You might have multiple lines for&amp;nbsp;&lt;SPAN&gt;updated_dt for combination of dimension, so you may need to use aggregate function to return single value for combination of dimensions used in aggr.&amp;nbsp; May be try below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;= IF(value = 'UNPLANNED' AND AGGR(COUNT(id + code + year), id + code + year) = 1&lt;BR /&gt;, Today() - &lt;STRONG&gt;AGGR(MAX(updated_dt), id, code, year)&lt;/STRONG&gt;&lt;BR /&gt;, AGGR(MAX(updated_dt), id, code, year) - AGGR(MIN(updated_dt), id, code, year)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can either use Min or Max in highlighted part based on your requirement&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 14:48:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832215#M68671</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2021-08-30T14:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use an AGGR(Max date) with same date in IF expression</title>
      <link>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832553#M68712</link>
      <description>&lt;P&gt;Thank you, that worked!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 15:06:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Trying-to-use-an-AGGR-Max-date-with-same-date-in-IF-expression/m-p/1832553#M68712</guid>
      <dc:creator>stsk</dc:creator>
      <dc:date>2021-08-31T15:06:54Z</dc:date>
    </item>
  </channel>
</rss>

