<?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: Aggregate function returning 0 values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190932#M384894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the quick reply, I have tried the expression but still getting the same result 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Sep 2016 05:04:36 GMT</pubDate>
    <dc:creator>pkpandey</dc:creator>
    <dc:date>2016-09-23T05:04:36Z</dc:date>
    <item>
      <title>Aggregate function returning 0 values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190930#M384892</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 am to show two values one for the current YTD and another is for last year YTD. &lt;SPAN style="font-size: 13.3333px;"&gt;I am using the given expression for Current YTD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(fabs(Sum({&amp;lt;Year={$(=Max(Year))},DATE={'&amp;lt;=$(vMaxDate)'}&amp;gt;} PREPAY_AMOUNT))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;+&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Year={$(=Max(Year))},DATE={'&amp;lt;=$(vMaxDate)'}&amp;gt;} PAY_AMT))*sum({&amp;lt;Year={$(=Max(Year))},DATE={'&amp;lt;=$(vMaxDate)'}&amp;gt;}distinct INR_RATE)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATE,INVOICE_ID))/100000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the following&amp;nbsp; for the last year YTD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(fabs(Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PREPAY_AMOUNT))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;+&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PAY_AMT))*&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;}distinct INR_RATE)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATE,INVOICE_ID))/100000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Both the expressions are working fine when there is no selection. But when a date is selected the last year YTD is always showing 0.&lt;/P&gt;&lt;P&gt;I have tested the expressions individually and it returns values which is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be highly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 04:52:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190930#M384892</guid>
      <dc:creator>pkpandey</dc:creator>
      <dc:date>2016-09-23T04:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate function returning 0 values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190931#M384893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Aggr() is being reduced by the selection, so you need to override the DATE selection:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sum(&lt;STRONG&gt;{&amp;lt;DATE&amp;gt;}&lt;/STRONG&gt; Aggr(&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(fabs(Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PREPAY_AMOUNT))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;+&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PAY_AMT))*&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;}distinct INR_RATE)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DATE,INVOICE_ID))/100000&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 04:59:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190931#M384893</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-09-23T04:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate function returning 0 values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190932#M384894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the quick reply, I have tried the expression but still getting the same result 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 05:04:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190932#M384894</guid>
      <dc:creator>pkpandey</dc:creator>
      <dc:date>2016-09-23T05:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate function returning 0 values</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190933#M384895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that you must include all the selections you need to override. Are you selecting DATE, and are you selecting other fields. For example, if you are selecting Month and Year:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;Month, Year&amp;gt;} Aggr(&lt;/P&gt;&lt;P&gt;(fabs(Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PREPAY_AMOUNT))&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;} PAY_AMT))*&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year={'$(vMaxYearLY)'},DATE={'&amp;lt;=$(vMaxDateLY)'}&amp;gt;}distinct INR_RATE)&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;DATE,INVOICE_ID))/100000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, I suggest you upload a small sample with some representative data for more detailed check.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 05:09:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-function-returning-0-values/m-p/1190933#M384895</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-09-23T05:09:35Z</dc:date>
    </item>
  </channel>
</rss>

