<?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 Aggr and Set Analysis (YTD Expression) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510705#M556899</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;My dataset is based around orders, and there can be multiple items per order, so my data is at Order-Item level.However, I need to calculate the average number of DaysToDeliver at Order level, so I have been using the following expression;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(only(DaysToDeliver),Order))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but when I try and amend the expression so that it is looking at Year to Date (based on week and month calendar selections), it doesn't seem to bring back the correct results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression I have been using is;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(only(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{$&amp;lt;DeliveryCalWeek = {"&amp;lt;=$(=max(DeliveryCalWeek))"},&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DeliveryCalMonth = {"&amp;lt;=$(=max(DeliveryCalMonth))"}&amp;gt;} &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DaysToDeliver), Order))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whatever I try, it seems to be ignoring the week and month parts of the expression. This works fine without AGGR, so I'm assuming it is this thats stopping the calculation from working correctly. I just can't figure out why, or how to correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this makes any difference. but it's a straight table I'm trying to use this expression in.&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>Wed, 26 Jun 2013 09:45:11 GMT</pubDate>
    <dc:creator>danielle_v</dc:creator>
    <dc:date>2013-06-26T09:45:11Z</dc:date>
    <item>
      <title>Aggr and Set Analysis (YTD Expression)</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510705#M556899</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;My dataset is based around orders, and there can be multiple items per order, so my data is at Order-Item level.However, I need to calculate the average number of DaysToDeliver at Order level, so I have been using the following expression;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(only(DaysToDeliver),Order))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but when I try and amend the expression so that it is looking at Year to Date (based on week and month calendar selections), it doesn't seem to bring back the correct results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression I have been using is;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(only(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{$&amp;lt;DeliveryCalWeek = {"&amp;lt;=$(=max(DeliveryCalWeek))"},&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DeliveryCalMonth = {"&amp;lt;=$(=max(DeliveryCalMonth))"}&amp;gt;} &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DaysToDeliver), Order))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whatever I try, it seems to be ignoring the week and month parts of the expression. This works fine without AGGR, so I'm assuming it is this thats stopping the calculation from working correctly. I just can't figure out why, or how to correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this makes any difference. but it's a straight table I'm trying to use this expression in.&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>Wed, 26 Jun 2013 09:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510705#M556899</guid>
      <dc:creator>danielle_v</dc:creator>
      <dc:date>2013-06-26T09:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr and Set Analysis (YTD Expression)</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510706#M556900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Danielle,&lt;/P&gt;&lt;P&gt;Like I replied in your last &lt;A _jive_internal="true" href="https://community.qlik.com/message/360748#360748"&gt;post&lt;/A&gt;, a simple and clar way to calculate the average for DaysToDeliver is to use avg(distinct DaysToDeliver). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 11:52:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510706#M556900</guid>
      <dc:creator>daveamz</dc:creator>
      <dc:date>2013-06-26T11:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr and Set Analysis (YTD Expression)</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510707#M556901</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;avg({&amp;lt;DateField = {"&amp;gt;=$(=YearStart(max(Datefield))) &amp;lt;=$(=max(Datefield))"},&lt;STRONG style="color: #737373; font-family: Arial;"&gt;DeliveryCalWeek&lt;/STRONG&gt; =, &lt;STRONG style="color: #737373; font-family: Arial;"&gt;DeliveryCalMonth&lt;/STRONG&gt; = &amp;gt;} &lt;STRONG style="color: #737373; font-family: Arial;"&gt;DaysToDeliver&lt;/STRONG&gt;) or if doen't helps then try to use &lt;/P&gt;&lt;P&gt;with aggrgation function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;avg(aggr(only(&lt;/STRONG&gt;&lt;STRONG&gt;{$&amp;lt;&lt;/STRONG&gt;DateField = {"&amp;gt;=$(=YearStart(max(Datefield))) &amp;lt;=$(=max(Datefield))"},&lt;STRONG style="color: #737373; font-family: Arial;"&gt;DeliveryCalWeek&lt;/STRONG&gt; =,&lt;STRONG style="color: #737373; font-family: Arial;"&gt;DeliveryCalMonth&lt;/STRONG&gt; = &amp;gt;} &lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;DaysToDeliver), Order))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;hope it helps&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 12:07:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510707#M556901</guid>
      <dc:creator>er_mohit</dc:creator>
      <dc:date>2013-06-26T12:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr and Set Analysis (YTD Expression)</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510708#M556902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I don't think this will work as there may be multiple orders with the same number of DaysToDeliver, so I don't think I'd be able to use avg(distinct DaysToDeliver) for this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 12:12:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-and-Set-Analysis-YTD-Expression/m-p/510708#M556902</guid>
      <dc:creator>danielle_v</dc:creator>
      <dc:date>2013-06-26T12:12:41Z</dc:date>
    </item>
  </channel>
</rss>

