<?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: Aggregation problem in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134995#M462857</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstedSortedValue(Aggr(Avg(value), code, date), -Aggr(date, code, date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Min&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;FirstedSortedValue(Aggr(Avg(value), code, date), Aggr(date, code, date))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Aug 2016 08:44:58 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-08-19T08:44:58Z</dc:date>
    <item>
      <title>Aggregation problem in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134994#M462856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got a problem in a set analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run the following : &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;avg({$&amp;lt;date={"$(=min(&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;date))"}&amp;gt;} value)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which should give me the average of the value on the minimum date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the dollar sign function &lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;$(=min(&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;date)) return the minimum date of the whole selected data set. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if I produce the following table : &lt;/P&gt;&lt;P&gt;&lt;IMG alt="qlik example.png" class="jive-image image-1" src="/legacyfs/online/134958_qlik example.png" style="height: 155px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see that most of time Max average and Min average are null, simply because on the &lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;$(=min(&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;date)) is using the minimum and the maximum of the whole selected data. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;I have been trying couple of options (use column(), some aggregation ...) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have an idea so the max average and min average will return the average on the Max date and min date for that code ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2016 02:39:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134994#M462856</guid>
      <dc:creator />
      <dc:date>2016-08-19T02:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134995#M462857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstedSortedValue(Aggr(Avg(value), code, date), -Aggr(date, code, date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Min&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;FirstedSortedValue(Aggr(Avg(value), code, date), Aggr(date, code, date))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2016 08:44:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134995#M462857</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-19T08:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134996#M462858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As alternative, you can try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Avg( Aggr(If( date = Max(Total&amp;lt;code&amp;gt; date), value), code, date, value))&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;=Avg( Aggr(If( date = Min(Total&amp;lt;code&amp;gt; date), value), code, date, value))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2016 22:17:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134996#M462858</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-08-19T22:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134997#M462859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I works pretty well ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to test few case but you apparently cracked it ! Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2016 02:37:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-in-set-analysis/m-p/1134997#M462859</guid>
      <dc:creator />
      <dc:date>2016-08-22T02:37:35Z</dc:date>
    </item>
  </channel>
</rss>

