<?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 Five Month Rolling Total in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261325#M495744</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bump. I'm hoping to get some input in the next 24 hours. Thanks &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Feb 2012 13:31:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-02-08T13:31:21Z</dc:date>
    <item>
      <title>Five Month Rolling Total</title>
      <link>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261324#M495743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Everyone,&lt;/P&gt;&lt;P&gt;I'm looking to create a formula that will give me the actual or forecasted cost of a catalog by month, and needs to be able to handle 3 different depending if it is a past month, the current month, or a future month. This will be placed in a pivot table chart that will show catalog cost by month for a year or years. To start off, I have set MM to be equal to the current month in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let MM=Peek('FSCLYRMM',0,'CURRENTDAY')&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's some fields that I have and their definitions&lt;/STRONG&gt; (FieldName - Definition). These numbers change and we pull in a 'snapshot' every couple weeks that appends the current data onto the end of existing data. The unique identifier of the 'snapshot' is a field called FileDate which is simply the date of the reload.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;WrittenOff &lt;/SPAN&gt;- Actualized catalog cost for a past month&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;TtlCost &lt;/SPAN&gt;- The catalogs total cost, the sum of all months that we amortize the cost of the book&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;PercDone &lt;/SPAN&gt;- Forecasted percent of catalogs TotalCost to be written off in a given month&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;TtlPercDone &lt;/SPAN&gt;- Cumulativepercentof catalogs TotalCost written off so far&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;TrendMonthName &lt;/SPAN&gt;- Ties a Month name to the month number through an inline load&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;TrendFiscalMonth &lt;/SPAN&gt;- The month number&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="text-decoration: underline;"&gt;TrendDate &lt;/SPAN&gt;- Fiscal Month beginning date&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here's an explination of what I want based on month.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Past Month&lt;/SPAN&gt;: WrittenOff &lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Current Month&lt;/SPAN&gt;: (TtlCost * TtlPercDone) -WrittenOff &lt;SPAN style="font-size: 8pt;"&gt; &lt;EM&gt;&amp;lt;---Only get Written off for past 5 months. Catalogs repeat every 10-14 months&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Future Month&lt;/SPAN&gt;: TtlCost * PercDone&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what I have right now. It seems to be working for past and future months, but not for the current month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;if((sum([WrittenOff]))&amp;lt;&amp;gt;0,sum({&amp;lt;[Trend Month Name]=,[TrendDate]=&amp;gt;}[WrittenOff])&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; // Take Written off if it exists (past months)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,if([TrendFiscalMonth]=$(MM) and [TrendFiscalYear]=$(YR), sum([TtlCost]*[TtlPercDone]) - sum({&amp;lt;[TrendMonthName]=,[TrendDate]=&amp;gt;}[WrittenOff])&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; // Current Month&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; ,sum([&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; white-space: pre; background-color: #ffffff;"&gt;TtlCost&lt;/SPAN&gt;]*[&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; white-space: pre; background-color: #ffffff;"&gt;PercDone&lt;/SPAN&gt;])))&amp;nbsp;&amp;nbsp; // future months&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is clear. Thanks a bunch for your help and let me know if you have any questions!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 23:02:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261324#M495743</guid>
      <dc:creator />
      <dc:date>2012-02-07T23:02:04Z</dc:date>
    </item>
    <item>
      <title>Five Month Rolling Total</title>
      <link>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261325#M495744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bump. I'm hoping to get some input in the next 24 hours. Thanks &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 13:31:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261325#M495744</guid>
      <dc:creator />
      <dc:date>2012-02-08T13:31:21Z</dc:date>
    </item>
    <item>
      <title>Five Month Rolling Total</title>
      <link>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261326#M495745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you compute the rolling Sums in the script and append it to the fact table with a field as 'RollingSum' AS DataType and 'Fact' AS DataType for all the rest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when you want to do the rolling sum, it would simply be SUM({&amp;lt;DataType={RollingSum}&amp;gt;}FieldName) in case you save the costs to the same fieldname as the Fact table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for performance and optimized speed, remove the set analysis and store the Rolling Sum in a new fieldName.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So ideally, you create a TempTable, and Concatenate the Fact table to that table 3 times, each time, adding the month by 1 and subtracting it by 1 so the data lines up. Now do a SUM() GROUPBY to shrink the table and CONCATENATE it to the FACT table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 14:03:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Five-Month-Rolling-Total/m-p/261326#M495745</guid>
      <dc:creator>avastani</dc:creator>
      <dc:date>2012-02-08T14:03:51Z</dc:date>
    </item>
  </channel>
</rss>

