<?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: FirstSortedValue with dates and aggr in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554506#M610497</link>
    <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Let me try to explain this with the following table :&lt;/P&gt;&lt;TABLE border="1" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Store Name&lt;/TD&gt;&lt;TD&gt;# Orders&lt;/TD&gt;&lt;TD&gt;Visitors Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;The above table has transactions for two stores. As you can see, the order and visitor details are not available from same dates. The order details are present from 01-01-2019 whereas the visitor details are present from different dates for each store. I want to compare number of orders against number of visitors for each store. To get correct numbers, I need to find out number of orders starting with dates when both order and visitor details are present (and not from 01-01-2019).&lt;/P&gt;&lt;P&gt;The expression&amp;nbsp;&lt;STRONG&gt;Date(Min(Aggr(If(Sum([Visitors Count]) &amp;lt;&amp;gt; 0, Date), Date,[Store Name]))) &lt;/STRONG&gt;gives me the minimum date from which visitor details are present for each store. Now I want to find out number of orders for dates greater than equal to this date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, store S2 has visitor details from&amp;nbsp;&lt;SPAN&gt;02-01-2019, so for store S2 total number of orders should be 10 (considering 02-01-2019, since when both order and visitor details are present), instead of 15 (if date 01-01-2019 was considered).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hopefully I can make some sense here. Please feel free to let me know in case you need some more info.&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Madhuparna Dhar&lt;/P&gt;</description>
    <pubDate>Sat, 09 Mar 2019 00:06:53 GMT</pubDate>
    <dc:creator>madhuparnadhar</dc:creator>
    <dc:date>2019-03-09T00:06:53Z</dc:date>
    <item>
      <title>FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392577#M610490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all, I have been battling with this problem for many days now and would like to ask for some help on how to solve. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table of data which contains transactions and mappings to different product types and I am trying to create a table that for each client entry and for each product type: &lt;/P&gt;&lt;P&gt;1. What is the first date of investment (where amount &amp;gt;0)&lt;/P&gt;&lt;P&gt;2. What is the amount in the first date of investment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I started off trying to create a set analysis to show the amount on a particular date using a variable for the min month but it got too complex so went down the first value route. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached file I share the data table - I am only interested in Aspect = R and for aggregation of the values at Prod_Cotegory_Desc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table I am trying to create would end up looking like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Client&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Product Category&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;First&amp;nbsp; Month of Investment&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Investment Amount&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Client 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;D&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jan-2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;129&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Client 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;E&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Aug-2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3,663&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Client 1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;PE&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jan-2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3,361&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Client 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;CL&amp;amp;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jan-2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;25,353&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Client 2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;D&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jan-2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;97&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the things I noticed with the data was that Qlik was not handling the date field sequentially so I created the FACT_MONTH_YEARDATE_NQA field on the date value so sorting was more simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The furthest I got was creating a formula something like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First Investment Date: &lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15130951496934277 jive_text_macro" jivemacro_uid="_15130951496934277" modifiedtitle="true"&gt;
&lt;P&gt;AGGR(&lt;/P&gt;
&lt;P&gt;FirstSortedValue(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(MIN({$&amp;lt;AMOUNT = {'&amp;gt;0'}&amp;gt;}FACT_MONTHYEAR_DATE),RELN_NBR,PROD_COTEGORY_DESC), //Mind date per prod&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(MIN(FACT_MONTHYEAR_DATE),RELN_NBR,PROD_COTEGORY_DESC) //sort by date and product&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;,RELN_NBR,PROD_COTEGORY_DESC)&amp;nbsp; //aggregate at product level&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This appears to produce the correct date value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amount for first investment date:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15130954617707799" jivemacro_uid="_15130954617707799" modifiedtitle="true"&gt;
&lt;P&gt;AGGR(&lt;/P&gt;
&lt;P&gt;FirstSortedValue(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(SUM({$&amp;lt;AMOUNT = {'&amp;gt;0'},ASPECT = {'R'}&amp;gt;}AMOUNT),RELN_NBR,PROD_COTEGORY_DESC), //Min amount per prod&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(MIN(FACT_MONTHYEAR_DATE),RELN_NBR,PROD_COTEGORY_DESC) //sort by date and product&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;,RELN_NBR,PROD_COTEGORY_DESC)&amp;nbsp; //aggregate at product level&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the result of the above is that it sums the R factor and does not show the minimum value. This minimum value would be the sum of all the values in the minimum month where aspect = R&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2017 16:19:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392577#M610490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-12T16:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392578#M610491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try these&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First Investment Date&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min(Aggr(If(Sum(AMOUNT) &amp;lt;&amp;gt; 0, FACT_MONTHYEAR_DATE_NQA), RELN_NBR, PROD_COTEGORY_DESC, FACT_MONTHYEAR_DATE_NQA), 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstValue&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Aggr(If(Sum(AMOUNT) &amp;lt;&amp;gt; 0, Sum(AMOUNT)), RELN_NBR, PROD_COTEGORY_DESC, FACT_MONTHYEAR_DATE_NQA), Aggr(If(Sum(AMOUNT) &amp;lt;&amp;gt; 0, FACT_MONTHYEAR_DATE_NQA), RELN_NBR, PROD_COTEGORY_DESC, FACT_MONTHYEAR_DATE_NQA), 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/186699_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2017 17:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392578#M610491</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-12-12T17:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392579#M610492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny - you are my hero! Works like a charm - thank-you so much!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2017 18:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1392579#M610492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-12T18:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554291#M610493</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;I was stuck with a similar problem and your solution worked for me as well. Will you please help me in understanding how you got the first investment date ?&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Madhuparna Dhar&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 14:37:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554291#M610493</guid>
      <dc:creator>madhuparnadhar</dc:creator>
      <dc:date>2019-03-08T14:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554304#M610494</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53461"&gt;@madhuparnadhar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Will you please help me in understanding how you got the first investment date ?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sure, but what exactly are you not clear about in the expression?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 14:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554304#M610494</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-03-08T14:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554331#M610495</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;I thought Aggr must have an aggregate function inside it to work. The IF statement inside Aggr returns the dates with count greater than 0 and I am wondering how the Aggr works with that.&lt;/P&gt;&lt;P&gt;I have one more query : I have transactions for four stores with individual first dates. I want to use this date in set analysis and get all the orders for dates greater than this first date. But I can't make it work right now. The expression that I am using currently is as below :&lt;/P&gt;&lt;P&gt;Count({&amp;lt; [Date]={"&amp;gt;=$(=Date(Min(Aggr(If(Sum([Visitors Count]) &amp;lt;&amp;gt; 0, Date), Date,[Store Name]))))"} &amp;gt;} Distinct [Order Number])&lt;/P&gt;&lt;P&gt;Could you please help me in figuring this out ?&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Madhuparna Dhar&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 15:53:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554331#M610495</guid>
      <dc:creator>madhuparnadhar</dc:creator>
      <dc:date>2019-03-08T15:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554343#M610496</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53461"&gt;@madhuparnadhar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I thought Aggr must have an aggregate function inside it to work. The IF statement inside Aggr returns the dates with count greater than 0 and I am wondering how the Aggr works with that.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not necessarily. If you have a single value based on the different dimensions you use in Aggr(), then you can use it without function. When we say without function there is a only() function which is optional and can be removed. What Only() means is that you have one and only one value for the list of the dimension.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53461"&gt;@madhuparnadhar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I have one more query : I have transactions for four stores with individual first dates. I want to use this date in set analysis and get all the orders for dates greater than this first date. But I can't make it work right now.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It would be rather difficult to solve a problem like this without a sample or sample data to look at. May be if you are able to share a sample with the output you expect to see from it, I might be able to help you out.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 16:21:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554343#M610496</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-03-08T16:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with dates and aggr</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554506#M610497</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Let me try to explain this with the following table :&lt;/P&gt;&lt;TABLE border="1" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Store Name&lt;/TD&gt;&lt;TD&gt;# Orders&lt;/TD&gt;&lt;TD&gt;Visitors Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03-01-2019&lt;/TD&gt;&lt;TD&gt;S1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03-01-2019&lt;/TD&gt;&lt;TD&gt;S2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;The above table has transactions for two stores. As you can see, the order and visitor details are not available from same dates. The order details are present from 01-01-2019 whereas the visitor details are present from different dates for each store. I want to compare number of orders against number of visitors for each store. To get correct numbers, I need to find out number of orders starting with dates when both order and visitor details are present (and not from 01-01-2019).&lt;/P&gt;&lt;P&gt;The expression&amp;nbsp;&lt;STRONG&gt;Date(Min(Aggr(If(Sum([Visitors Count]) &amp;lt;&amp;gt; 0, Date), Date,[Store Name]))) &lt;/STRONG&gt;gives me the minimum date from which visitor details are present for each store. Now I want to find out number of orders for dates greater than equal to this date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, store S2 has visitor details from&amp;nbsp;&lt;SPAN&gt;02-01-2019, so for store S2 total number of orders should be 10 (considering 02-01-2019, since when both order and visitor details are present), instead of 15 (if date 01-01-2019 was considered).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hopefully I can make some sense here. Please feel free to let me know in case you need some more info.&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Madhuparna Dhar&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2019 00:06:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-dates-and-aggr/m-p/1554506#M610497</guid>
      <dc:creator>madhuparnadhar</dc:creator>
      <dc:date>2019-03-09T00:06:53Z</dc:date>
    </item>
  </channel>
</rss>

