<?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: How to do a count on a max(date) - one year expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189297#M384437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is no way you can Sum(Name) assuming Name is text... try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=&lt;SPAN style="color: #ff0000;"&gt;Count&lt;/SPAN&gt;({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;=&lt;/SPAN&gt;AddYears(Max(Date), -1)&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;)&lt;/SPAN&gt;"}&amp;gt;}Name)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You further might need to add Date() function if you date format is different then the QlikView's default's dateformat set during the reload in the environmental variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Count({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(=&lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;AddYears(Max(Date), -1)&lt;SPAN style="color: #ff0000;"&gt;, 'DateFieldFormatHere'&lt;/SPAN&gt;))"}&amp;gt;}Name)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally Do you need a distinct count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Count(&lt;SPAN style="color: #ff0000;"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt;Referral={'Yes'}, Date&lt;SPAN style="color: #3d3d3d;"&gt; = {"&amp;lt;=$(=Date(AddYears(Max(Date), -1), 'DateFieldFormatHere'))"}&amp;gt;}Name)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2016 09:20:48 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-09-22T09:20:48Z</dc:date>
    <item>
      <title>How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189293#M384433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an issue where I am trying to do a count on the following expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(max(Date&amp;lt;=Today()-365), Max(Date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As soon as I add a count I get a nested aggr not allowed error.&lt;/P&gt;&lt;P&gt;I tried using set analysis like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(addyears(max(Date),-1)"}&amp;gt;}Name)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But get a error in set modifer ad hoc element list: ',' or ')' expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count(If(Aggr(NODISTINCT Max(date), id) = date, id))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this just gives me errors also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do a simple count on a max(date) minus one year?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 08:43:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189293#M384433</guid>
      <dc:creator>samantha92</dc:creator>
      <dc:date>2016-09-21T08:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189294#M384434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This looks to be along the right lines but you're missing a )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(addyears(max(Date),-1)&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;"}&amp;gt;}Name)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 08:15:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189294#M384434</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2016-09-22T08:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189295#M384435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adam is right, but you are calculation is name. Does name field has values or characters&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 08:45:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189295#M384435</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2016-09-22T08:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189296#M384436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might also need an &lt;STRONG&gt;'='&lt;/STRONG&gt; like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=sum({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&lt;/SPAN&gt;addyears(max(Date),-1)&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #ff0000;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;"}&amp;gt;}Name)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 08:49:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189296#M384436</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2016-09-22T08:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189297#M384437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is no way you can Sum(Name) assuming Name is text... try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=&lt;SPAN style="color: #ff0000;"&gt;Count&lt;/SPAN&gt;({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;=&lt;/SPAN&gt;AddYears(Max(Date), -1)&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;)&lt;/SPAN&gt;"}&amp;gt;}Name)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You further might need to add Date() function if you date format is different then the QlikView's default's dateformat set during the reload in the environmental variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Count({&amp;lt;Referral={'Yes'}, Date = {"&amp;lt;=$(=&lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;AddYears(Max(Date), -1)&lt;SPAN style="color: #ff0000;"&gt;, 'DateFieldFormatHere'&lt;/SPAN&gt;))"}&amp;gt;}Name)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally Do you need a distinct count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Count(&lt;SPAN style="color: #ff0000;"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt;Referral={'Yes'}, Date&lt;SPAN style="color: #3d3d3d;"&gt; = {"&amp;lt;=$(=Date(AddYears(Max(Date), -1), 'DateFieldFormatHere'))"}&amp;gt;}Name)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 09:20:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189297#M384437</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-22T09:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a count on a max(date) - one year expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189298#M384438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah of course, always helps when you have another set of eyes looking at something to spot your mistakes &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have changed name to ID and added the date &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you everyone for your help!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 12:52:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-a-count-on-a-max-date-one-year-expression/m-p/1189298#M384438</guid>
      <dc:creator>samantha92</dc:creator>
      <dc:date>2016-09-22T12:52:07Z</dc:date>
    </item>
  </channel>
</rss>

