<?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: The Maximum Date in Month in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618366#M681718</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Darek, I deeply appreciate for your close support, and we are very close to resoluting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having deliberating on it, the issue seems my side: here is the logic construction: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Select &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;only those Product Serial, which has any document date in the targeted month&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;//and then, &lt;STRONG style="text-decoration: underline;"&gt;sum up the weight, only up to the target month&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*For example, please look ProductSerial 24551. Initial document is issued on 81.02.2014, and cancelled on 12.03.2014, and re-issued within same date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Let's select target month '-1', i.e. March. (Let's see ProductSerial 24551 specifically) &lt;/LI&gt;&lt;LI&gt;In this case, the logic must include 24551 because it has DocDate in March&lt;/LI&gt;&lt;LI&gt;The logic must sum up only up to &lt;EM&gt;MonthEnd()&lt;/EM&gt; = &lt;EM&gt;end of march&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt; sum +1 -1 +1, resulting in +1. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The total must be &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;818&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; in the attached QV. If it resulted as 814, it is due to some product serials having +/-1 within the same month, and offseting completely. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(previous month) +1&lt;/P&gt;&lt;P&gt;(this month)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1&lt;/P&gt;&lt;P&gt;(this monty)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current formula summarize the this-month only, and treat as 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**attached is the QV file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Apr 2014 08:08:03 GMT</pubDate>
    <dc:creator>atsushi_saijo</dc:creator>
    <dc:date>2014-04-14T08:08:03Z</dc:date>
    <item>
      <title>The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618360#M681712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a case where I must select maximum date in a month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The source table is as such:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="100" style="border: 1px solid #000000; width: 333px; height: 96px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ProductSerial&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Doc#&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ActType&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;DocDate&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Weight&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="1"&gt;S0001&lt;/TD&gt;&lt;TD colspan="1"&gt;001&lt;/TD&gt;&lt;TD colspan="1"&gt;Issued&lt;/TD&gt;&lt;TD colspan="1"&gt;26.02.2014&lt;/TD&gt;&lt;TD colspan="1"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;S0001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14.03.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;S0001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;003&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Issued&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18.03.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;S0001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;004&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cancelled&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;03.04.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;S0001&lt;/TD&gt;&lt;TD&gt;005&lt;/TD&gt;&lt;TD&gt;Issued&lt;/TD&gt;&lt;TD&gt;03.04.2014&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ProductSerial 'S0001' has 5 associated documents: Doc# {001; 002; 003; 004; 005}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Sum all the Weight up to last Month-End, and if it were &amp;gt;0, then take the maximum DocDate with 'Issued' on the last month.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, 18.03.2014 should be selected, and such table should be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="50" style="border: 1px solid #000000; width: 244px; height: 35px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ProductSerial&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;DocDate&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Weight&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;S0001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;18.03.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;[Dimention 1] = ProductSerial;&lt;/LI&gt;&lt;LI&gt;[Dimention 2] = FirstSortedDate(DocDate,-DocDate) // does not work;&lt;/LI&gt;&lt;LI&gt;[or Dimention 2] = If(FKDAT&amp;lt;=MonthEnd(Today(0),-1),Max(DocDate)) // does not work;&lt;/LI&gt;&lt;LI&gt;[Expression] = Sum( If( InMonthToDate(DocDate, MonthEnd( Today(0), 0), 0), Weight));&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you possibly advise how the last DocDate could be displayed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**This 'maximum date' changes as user selects the targeted reporting month. (In this case, MonthEnd(Today(), -$(X)) ) is used with X as input value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd apprecaite for your feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Atsushi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 12:35:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618360#M681712</guid>
      <dc:creator>atsushi_saijo</dc:creator>
      <dc:date>2014-04-09T12:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618361#M681713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Atsushi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i prepared example, which i hope adressess your needs &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;For test purposes i prepared few more docs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if it is ok and if you like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 19:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618361#M681713</guid>
      <dc:creator />
      <dc:date>2014-04-09T19:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618362#M681714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look for comm_maxdateinmonth_thr_505527.qvw&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 08:09:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618362#M681714</guid>
      <dc:creator />
      <dc:date>2014-04-10T08:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618363#M681715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why not:&lt;/P&gt;&lt;P&gt;weight sum to the end of closed month:&lt;/P&gt;&lt;P&gt;if(sum({&amp;lt;DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&amp;gt;0,sum({&amp;lt;DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;last issue date to the end of closed month:&lt;/P&gt;&lt;P&gt;date(if(sum({&amp;lt;DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&amp;gt;0,FirstSortedValue({&amp;lt;ActType={'Issued'},DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}DocDate,-DocDate)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where X i value selected by user from field (1,2,3,4,5,....) - it is offset of months.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 16:23:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618363#M681715</guid>
      <dc:creator />
      <dc:date>2014-04-11T16:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618364#M681716</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 should be back in about 2 hours...&lt;/P&gt;&lt;P&gt;I try to understand what's changed. I have also to recall my solution for myself &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; It was few days ago i prepared it. From that time i prepared many solutions on this forum &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; So, i can't remember every one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need my help. please provide some test data with current and expected result. It will be fastet way for me to understand what to change &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;regards&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 17:22:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618364#M681716</guid>
      <dc:creator />
      <dc:date>2014-04-11T17:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618365#M681717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need this?:&lt;/P&gt;&lt;P&gt;Lokk for attachment. There are 2 new expressions (named new1 and new2).&lt;/P&gt;&lt;P&gt;new1:&lt;/P&gt;&lt;P&gt;chooses product_serials, for which Weight in "selected" month is positive.&lt;/P&gt;&lt;P&gt;{&amp;lt;DocDate={"&amp;gt;=$(=MonthStart(Today(0),$(=only(X))))&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&amp;gt;0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for those serials calculates sum(Weght) from the beginning of that serial history ubtil end of this "selected" month&lt;/P&gt;&lt;P&gt;sum({&amp;lt;DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new2:&lt;/P&gt;&lt;P&gt;chooses product_serials, for which Weight in "selected" month is positive.&lt;/P&gt;&lt;P&gt;{&amp;lt;DocDate={"&amp;gt;=$(=MonthStart(Today(0),$(=only(X))))&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&amp;gt;0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for those serials calculates sum(Weght) from the beginning of that serial history ubtil end of this "selected" month&lt;/P&gt;&lt;P&gt;sum({&amp;lt;DocDate={"&amp;lt;=$(=MonthEnd(Today(0),$(=only(X))))"}&amp;gt;}Weight)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new3 - new criteria to choose possible records to get last issue date:&lt;/P&gt;&lt;P&gt;(the same condiotions as in new1 and new2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need more help and if you found correct answer. If yes, you should close thread, to to avoid that people who trying to help will still working on solution for your problem....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 19:01:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618365#M681717</guid>
      <dc:creator />
      <dc:date>2014-04-11T19:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618366#M681718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Darek, I deeply appreciate for your close support, and we are very close to resoluting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having deliberating on it, the issue seems my side: here is the logic construction: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Select &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;only those Product Serial, which has any document date in the targeted month&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;//and then, &lt;STRONG style="text-decoration: underline;"&gt;sum up the weight, only up to the target month&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*For example, please look ProductSerial 24551. Initial document is issued on 81.02.2014, and cancelled on 12.03.2014, and re-issued within same date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Let's select target month '-1', i.e. March. (Let's see ProductSerial 24551 specifically) &lt;/LI&gt;&lt;LI&gt;In this case, the logic must include 24551 because it has DocDate in March&lt;/LI&gt;&lt;LI&gt;The logic must sum up only up to &lt;EM&gt;MonthEnd()&lt;/EM&gt; = &lt;EM&gt;end of march&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt; sum +1 -1 +1, resulting in +1. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The total must be &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;818&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; in the attached QV. If it resulted as 814, it is due to some product serials having +/-1 within the same month, and offseting completely. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(previous month) +1&lt;/P&gt;&lt;P&gt;(this month)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1&lt;/P&gt;&lt;P&gt;(this monty)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current formula summarize the this-month only, and treat as 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**attached is the QV file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 08:08:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618366#M681718</guid>
      <dc:creator>atsushi_saijo</dc:creator>
      <dc:date>2014-04-14T08:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618367#M681719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Manish, Darek, and Toni, I appreciate for your fast responses.&lt;/P&gt;&lt;P&gt;I have created another thread &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;"Max(TOTAL &amp;lt;&amp;gt;) statement within If statement"&lt;/EM&gt;&lt;/SPAN&gt; based on aggragation, but this thread is valid too. I'd await for your feedback if any. In any case all the input are helpful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****@18:38&lt;/P&gt;&lt;P&gt;I have created an AUTONUMBER(MONTH(DocDate)) as FKM#in the loading script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;Sum(if(&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;FKDAT_c&amp;lt;=MonthEnd(Today(0),-$(X)),&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;CEIL(AGGR(Weight,ProductSerial,FKM#,ACTTYPE),1)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -Sum(if(&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;FKDAT_c&amp;lt;=MonthEnd(Today(0),-($(X)+1)),&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;CEIL(AGGR(Weight,ProductSerial,FKM#,ACTTYPE),1)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produced 818.&lt;/P&gt;&lt;P&gt;****@09:56&lt;/P&gt;&lt;P&gt;Darek has produced following statement, which produced the right result. Further I'd clarify the if(count() ) statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(count({&amp;lt;DocDate={"&amp;gt;=$(=MonthStart(Today(0),$(=-Y)))&amp;lt;=$(=MonthEnd(Today(0),$(=-Y)))"}&amp;gt;} DocDate)&amp;gt;0 ,sum(Weight) )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 13:42:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618367#M681719</guid>
      <dc:creator>atsushi_saijo</dc:creator>
      <dc:date>2014-04-14T13:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: The Maximum Date in Month</title>
      <link>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618368#M681720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Manish and Toni, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate for your input. I branched out the discussion, and could not designate the helpful answer. But all in all, I appreciated your input. The very issue were resolved in two ways: [a.] one way by subtraction and change of weight assignment: [b.] another is to use if (count () ) statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very best wishes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Atsushi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 08:27:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/The-Maximum-Date-in-Month/m-p/618368#M681720</guid>
      <dc:creator>atsushi_saijo</dc:creator>
      <dc:date>2014-04-15T08:27:50Z</dc:date>
    </item>
  </channel>
</rss>

