<?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() function in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088727#M362302</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please close the thread down by marking correct and helpful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Mar 2016 12:51:21 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-03-29T12:51:21Z</dc:date>
    <item>
      <title>Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088719#M362294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #000000; font-size: 10pt;"&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I am using the aggr() function for the very first time and is getting a bit confused.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I have the following table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/119658_Capture.PNG" style="height: auto;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;As it can be seen from the table, the price for a part varies from one order to another (ie. from order data to another order date). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Basically I want to perform a GROUP BY on the part field to retrieve the price for each part where the Order date is the latest one. In short I want a straight table with just the blue records (Order IDs 1, 4, 6, 9).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Till now I managed to get the latest order for each part by using the following expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14592485408108109 jive_text_macro" jivemacro_uid="_14592485408108109"&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;[Order Date]&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;), [&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;Part ID]&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9pt; font-family: Arial, sans-serif; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;However, I am finding it a problem in getting the corresponding price. I tried to used the aggr() expression above in the following way:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14592485644581500 jive_text_macro" jivemacro_uid="_14592485644581500"&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;only&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;({&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;[Order Date]&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;={'$(=Date(aggr( Max([Order Date]), [Part ID])))'}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt; Price&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt; font-family: 'Courier New';"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9pt; font-family: arial, helvetica, sans-serif; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;However this is not returning the desired result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Can anyone suggest how this can be done?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, helvetica, sans-serif;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 10:51:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088719#M362294</guid>
      <dc:creator />
      <dc:date>2016-03-29T10:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088720#M362295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this expression:&lt;/P&gt;&lt;P&gt;1) Date(Max([Order Date]))&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2)&lt;STRONG&gt; FirstSortedValue(Price, -[Order Date])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimensions:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;1) [Order ID]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2) [Part ID]&lt;/P&gt;&lt;P&gt;3) [Part Desc]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; I think you don't need [Order ID] as a dimension. If you need to know that information you can add it like an expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue([Order ID], -[Order Date])&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 10:56:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088720#M362295</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-03-29T10:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088721#M362296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue( Price, -[Order Date])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 10:56:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088721#M362296</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-03-29T10:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088722#M362297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Create Straight Table&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Dimension:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;OrderID&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;PartID&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Part Description&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Expression:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=FirstSortedValue(Price ,- Order Date)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 10:57:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088722#M362297</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2016-03-29T10:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088723#M362298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just try with this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;firststoredvalue(price,-[order date])&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 11:00:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088723#M362298</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2016-03-29T11:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088724#M362299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sample attached&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/119653_Capture.PNG" style="height: 232px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: In future paste your data as text instead of image so that creating a sample is easier for the people who are trying to help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 11:08:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088724#M362299</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-03-29T11:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088725#M362300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all for your help it worked perfectly fine &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 12:50:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088725#M362300</guid>
      <dc:creator />
      <dc:date>2016-03-29T12:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088726#M362301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sunny for providing the QVW with an explanation. You're right next time I will but the data as text rather than an image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 12:50:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088726#M362301</guid>
      <dc:creator />
      <dc:date>2016-03-29T12:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() function in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088727#M362302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please close the thread down by marking correct and helpful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 12:51:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-function-in-set-analysis/m-p/1088727#M362302</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-03-29T12:51:21Z</dc:date>
    </item>
  </channel>
</rss>

