<?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 Count with only the last day in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329708#M579039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing up to this problem (qvw attached):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have employees&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I have dates (from 2009 to 2011)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;I need to count these employees per year, month and day in a drill down&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) The difficulty is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) For the &lt;SPAN style="text-decoration: underline;"&gt;year&lt;/SPAN&gt;, I need to count only for the &lt;SPAN style="text-decoration: underline;"&gt;last day of the year&lt;/SPAN&gt; (ex: for 2011 I count employees for 12/31/2011)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) For the &lt;SPAN style="text-decoration: underline;"&gt;month&lt;/SPAN&gt;, I need to count only for the &lt;SPAN style="text-decoration: underline;"&gt;last day of the month&lt;/SPAN&gt; (ex : for Feb-2012 I count employees for 29/02/2012)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c) For the &lt;SPAN style="text-decoration: underline;"&gt;day&lt;/SPAN&gt;, no problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) What I tried : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) &lt;STRONG&gt;To do a Set Analysis&lt;/STRONG&gt;. The problem is that when I ask the max(date) it doesn't take care of the dimensions anymore (which is the normal rule for the Set Analysis). Actually, when I do that in my graph, it only returns the counting for the last day of my whole date field (12/31/2012)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) &lt;STRONG&gt;Do it in the script. &lt;/STRONG&gt;The problem is that I loose my hierarchy because, for example, 2009 only points on 12/31/2009 so when I click on 2009 in my drill down, I will only select Dec-2009.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe there is a way that the Set Analysis can take consideration of the dimensions but i don't know how. &lt;/P&gt;&lt;P&gt;Stay available for any more questions.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Feb 2012 17:15:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-02-29T17:15:56Z</dc:date>
    <item>
      <title>Count with only the last day</title>
      <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329708#M579039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing up to this problem (qvw attached):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have employees&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I have dates (from 2009 to 2011)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;I need to count these employees per year, month and day in a drill down&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) The difficulty is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) For the &lt;SPAN style="text-decoration: underline;"&gt;year&lt;/SPAN&gt;, I need to count only for the &lt;SPAN style="text-decoration: underline;"&gt;last day of the year&lt;/SPAN&gt; (ex: for 2011 I count employees for 12/31/2011)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) For the &lt;SPAN style="text-decoration: underline;"&gt;month&lt;/SPAN&gt;, I need to count only for the &lt;SPAN style="text-decoration: underline;"&gt;last day of the month&lt;/SPAN&gt; (ex : for Feb-2012 I count employees for 29/02/2012)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c) For the &lt;SPAN style="text-decoration: underline;"&gt;day&lt;/SPAN&gt;, no problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) What I tried : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) &lt;STRONG&gt;To do a Set Analysis&lt;/STRONG&gt;. The problem is that when I ask the max(date) it doesn't take care of the dimensions anymore (which is the normal rule for the Set Analysis). Actually, when I do that in my graph, it only returns the counting for the last day of my whole date field (12/31/2012)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) &lt;STRONG&gt;Do it in the script. &lt;/STRONG&gt;The problem is that I loose my hierarchy because, for example, 2009 only points on 12/31/2009 so when I click on 2009 in my drill down, I will only select Dec-2009.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe there is a way that the Set Analysis can take consideration of the dimensions but i don't know how. &lt;/P&gt;&lt;P&gt;Stay available for any more questions.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Feb 2012 17:15:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329708#M579039</guid>
      <dc:creator />
      <dc:date>2012-02-29T17:15:56Z</dc:date>
    </item>
    <item>
      <title>Count with only the last day</title>
      <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329709#M579040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 17:29:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329709#M579040</guid>
      <dc:creator />
      <dc:date>2012-03-01T17:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count with only the last day</title>
      <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329710#M579041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer Marcus. Actually it's exactly what I am looking for. I have put a new column (see example) to explain it. As you can see in the qvw file, I have made it work for the first line and I need to do that for all the lines in dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you see what I mean?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 20:21:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329710#M579041</guid>
      <dc:creator />
      <dc:date>2012-03-01T20:21:21Z</dc:date>
    </item>
    <item>
      <title>Count with only the last day</title>
      <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329711#M579042</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;It would be easier if you arrive new fields like IsYearEnd and IsMonthEnd in script itself.&amp;nbsp; Please check the script below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LOAD _key_date, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Date = YearEnd(Date), 1, 0) AS IsYearEnd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Date = MonthEnd(Date), 1, 0) AS IsMonthEnd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(Date) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(Date) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day(Date) as Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(Date)&amp;amp;'-'&amp;amp;month(Date) as Period&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;data\data.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Calendar$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now create a drilldown group(assume the name as DateDrillDown) with Year, Month and Day.&amp;nbsp; Now use this as Dimension in you Chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now your expression should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=If(GetCurrentField(DateDrillDown) = 'Year', sum({&amp;lt;IsYearEnd={1}&amp;gt;}Activity),&lt;/P&gt;&lt;P&gt;If(GetCurrentField(DateDrillDown) = 'Month', sum({&amp;lt;IsMonthEnd={1}&amp;gt;}Activity), sum(Activity)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 05:51:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329711#M579042</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-03-02T05:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count with only the last day</title>
      <link>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329712#M579043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jagan it's working!!! I just had a problem with YearEnd and MonthEnd because of the hours.&lt;/P&gt;&lt;P&gt;Ex : MonthEnd(06/03/2012) returns 31/03/2012 23:59:59.999!! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even with numeric format it was not working so I only found this solution :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LOAD _key_date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Date =date(AddYears(YearStart(Date),1)-1), 1, 0) AS IsYearEnd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Date = date(addmonths(MonthStart(Date),1)-1), 1, 0) AS IsMonthEnd, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(Date) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(Date) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day(Date) as Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(Date)&amp;amp;'-'&amp;amp;month(Date) as Period&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;data\data.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Calendar$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But thanks for the idea especially the GetCurrentField function that I didn't think to use!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2012 10:57:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-with-only-the-last-day/m-p/329712#M579043</guid>
      <dc:creator />
      <dc:date>2012-03-06T10:57:22Z</dc:date>
    </item>
  </channel>
</rss>

