<?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: Calculate sum based on start date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792624#M1034945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any help guys ? I have been stuck with this problem for a while now&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jan 2015 04:40:51 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-01-30T04:40:51Z</dc:date>
    <item>
      <title>Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792623#M1034944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables - sales and location.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Location: Has Location Code and start Date&lt;/P&gt;&lt;P&gt;Sales : Has Location Code and Sales for last year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;I loaded sales as cross table and set up a master calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have managed to calculate the sum of sales for the last 4 months. But for this example I have hardcoded 4. I actually need to go back as far the start month for each location. For example, Location 11 needs to have the sales calculated from period 201406. How do I achieve this with the expression I have currently used? =sum({$&amp;lt;[PeriodID] = {"&amp;gt;$(=Max([PeriodID])-4)"}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the file with this post. I also need to consider new sales data will be added for 2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/76621_pastedImage_3.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 16:52:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792623#M1034944</guid>
      <dc:creator />
      <dc:date>2015-01-29T16:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792624#M1034945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any help guys ? I have been stuck with this problem for a while now&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 04:40:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792624#M1034945</guid>
      <dc:creator />
      <dc:date>2015-01-30T04:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792625#M1034946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try like this&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;[PeriodID] = {"&amp;gt;$(=&lt;SPAN class="Code"&gt;monthstart&lt;/SPAN&gt;([PeriodID])-4)"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 05:04:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792625#M1034946</guid>
      <dc:creator>arulsettu</dc:creator>
      <dc:date>2015-01-30T05:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792626#M1034947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not able to grasp what you need ?&lt;/P&gt;&lt;P&gt;Please explain according to your given sample objects that what functionality you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 05:05:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792626#M1034947</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2015-01-30T05:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792627#M1034948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the expression , I have hardcoded the number 4.&amp;nbsp; As in calculate sales for the last four months,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this number needs to be generated based on the month of start date of the location. In the example shown, Location code 11 has a start date of 6/1/2008. The month is june. So I need to calculate the sales from june to current ( last seven months)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you have additional questions&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 05:09:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792627#M1034948</guid>
      <dc:creator />
      <dc:date>2015-01-30T05:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792628#M1034949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just convert periodID as Date first. Then you have to calculate the difference of the periodid month and the Startdate month.Now you can use these autogenerated difference in&amp;nbsp; months in your&amp;nbsp; expression.&lt;/P&gt;&lt;P&gt;Or just join both tables and Calculate a flag as &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(PeriodID&amp;gt;=StartDate,1,0) as CalculateFlag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use expression as &lt;STRONG&gt;Sum({&amp;lt;CalculateFlag={'1'}&amp;gt;}Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 06:14:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792628#M1034949</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2015-01-30T06:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792629#M1034950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please provide the working example? I have attached the file in my original post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 16:13:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792629#M1034950</guid>
      <dc:creator />
      <dc:date>2015-01-30T16:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792630#M1034951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it to work using the expression = sum({$&amp;lt;Month={'&amp;gt;=$(=num(month([Start Date])))'}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However this will not work when I show all locations in a table&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/76732_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I select a particular start date, it works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/76772_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gather I probably need to use aggregation by start date somewhere ? I am getting close but still not there yet. Attaching the updated file. Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 17:26:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792630#M1034951</guid>
      <dc:creator />
      <dc:date>2015-01-30T17:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792631#M1034952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sum(if(makedate(left(Period,4),Right(Period,2))&amp;gt;[Start Date], Sales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 19:34:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792631#M1034952</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-01-30T19:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792632#M1034953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Massimo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your expression is not working as I expected. I have attached the sample application for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did get the expression to work but as i mentioned a little earlier, i need to select a specific start date to have it displayed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 19:54:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792632#M1034953</guid>
      <dc:creator />
      <dc:date>2015-01-30T19:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792633#M1034954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;and what's wrong with my expression?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum(if(makedate(left(Period,4),Right(Period,2))&amp;gt;[Start Date], Sales))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum(if(makedate(left(Period,4),Right(Period,2))&lt;STRONG&gt;&amp;gt;=&lt;/STRONG&gt;[Start Date], Sales))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;can you give an example of an incorrect &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;location, period, sales, total sales &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;for my exp?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 20:05:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792633#M1034954</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-01-30T20:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792634#M1034955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The expression you provided is not working for all locations. For example in the below example , it needs to calculate from period 201408 onwards only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/76785_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 20:14:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792634#M1034955</guid>
      <dc:creator />
      <dc:date>2015-01-30T20:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792635#M1034956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;last try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(makedate(left(Period,4),Right(Period,2))&amp;gt;=&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(month([Start Date])&amp;gt;month(today()),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; makedate(year(today())-1,month([Start Date])),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; makedate(year(today()),month([Start Date])) ), &lt;/P&gt;&lt;P&gt;&amp;nbsp; Sales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 21:03:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792635#M1034956</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-01-30T21:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792636#M1034957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can not reload the file since i do not have the sources.&lt;/P&gt;&lt;P&gt;Well let me give you a sample in couple of minutes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 21:34:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792636#M1034957</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2015-01-30T21:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792637#M1034958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the sample.&lt;/P&gt;&lt;P&gt;Note i do not implemented the Master Calender table.&lt;/P&gt;&lt;P&gt;But it will resolve your issue in a best way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 21:44:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792637#M1034958</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2015-01-30T21:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792638#M1034959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sujeet. This is helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 22:02:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792638#M1034959</guid>
      <dc:creator />
      <dc:date>2015-01-30T22:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sum based on start date</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792639#M1034960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is it.Thank you so much Massimo Grossi &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 22:04:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sum-based-on-start-date/m-p/792639#M1034960</guid>
      <dc:creator />
      <dc:date>2015-01-30T22:04:16Z</dc:date>
    </item>
  </channel>
</rss>

