<?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: Using aggr and total with date ranges in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402193#M559574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Alan and it is a little helpful.&amp;nbsp; The problem I am still running into is that it is not relative to the particular row in the chart.&amp;nbsp; More explictly &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MAX(TOTAL Date)&lt;/SPAN&gt; always resolves to the same thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am trying to find is something I can put in a sum( ) expression that will resolve to something different depending on the row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the previous table as an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="142" style="background-color: #ffffff; border: 1px solid #000000; margin: 1px 0; padding: 3px; color: #737373; font-family: Arial;"&gt;&lt;TBODY&gt;&lt;TR style="border: 0px;"&gt;&lt;TH align="center" style="border: 1px solid #000000; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Weekend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="border: 1px solid #000000; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;# of&amp;nbsp; new customers&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/21/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;50 &amp;lt;- sum() Calculated on the date range 4/21/2013&amp;nbsp; 4/22/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/14/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;27 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 4/14/2013&amp;nbsp; 4/14/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/07/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;13 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 4/07/2013&amp;nbsp; 4/07/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;3/31/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;68 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 3/31/2013&amp;nbsp; 3/31/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;3/24/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;44 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 3/24/2013&amp;nbsp; 3/24/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not entirely certain it is possible to do via an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2013 19:55:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-04-25T19:55:53Z</dc:date>
    <item>
      <title>Using aggr and total with date ranges</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402191#M559572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create a chart with the number of new customers that we have sold to this week. Where new is defined as anyone who has not bought from us in a set timeframe. (Eg last 3 years)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Idea of chart would be:&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="142" style="width: 365px; border: 1px solid rgb(0, 0, 0); height: 144px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Weekend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;# of&amp;nbsp; new customers&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4/21/2013&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4/14/2013&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4/07/2013&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3/31/2013&lt;/TD&gt;&lt;TD&gt;68&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3/24/2013&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The underlying table basically looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OrderId, AccountId, Date, Amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have gotten close with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension: Weekend(Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression: sum(aggr(if(sum(Amount) = sum(TOTAL&amp;lt;AccountId&amp;gt; Amount),1,0),Date,AccountId))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that the Total is not date bound by the Order Date, and will pick up both older orders than we want and more recent orders which also want to be excluded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or direction would be much appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick Clift&lt;/P&gt;&lt;P&gt; DVL Inc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 18:44:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402191#M559572</guid>
      <dc:creator />
      <dc:date>2013-04-25T18:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr and total with date ranges</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402192#M559573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try the following,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a Variable and then paste this into it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 936px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="936"&gt;Date = {"&amp;gt;=$(=DATE(ADDMONTHS(FLOOR(MONTHSTART(MAX(TOTAL Date))), -35)))&amp;lt;=$(=DATE(FLOOR(MONTHEND(MAX(TOTAL Date)))))"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call the variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; last.3.years&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use the following Expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM({&amp;lt;$(last.3.years)&amp;gt;}Amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 19:21:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402192#M559573</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2013-04-25T19:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr and total with date ranges</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402193#M559574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Alan and it is a little helpful.&amp;nbsp; The problem I am still running into is that it is not relative to the particular row in the chart.&amp;nbsp; More explictly &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MAX(TOTAL Date)&lt;/SPAN&gt; always resolves to the same thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am trying to find is something I can put in a sum( ) expression that will resolve to something different depending on the row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the previous table as an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="142" style="background-color: #ffffff; border: 1px solid #000000; margin: 1px 0; padding: 3px; color: #737373; font-family: Arial;"&gt;&lt;TBODY&gt;&lt;TR style="border: 0px;"&gt;&lt;TH align="center" style="border: 1px solid #000000; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Weekend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="border: 1px solid #000000; background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;# of&amp;nbsp; new customers&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/21/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;50 &amp;lt;- sum() Calculated on the date range 4/21/2013&amp;nbsp; 4/22/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/14/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;27 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 4/14/2013&amp;nbsp; 4/14/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;4/07/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;13 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 4/07/2013&amp;nbsp; 4/07/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;3/31/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;68 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 3/31/2013&amp;nbsp; 3/31/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px;"&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;3/24/2013&lt;/TD&gt;&lt;TD style="border: 1px solid #000000; margin: 1px; padding: 3px;"&gt;44 &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&amp;lt;- sum() Calculated on the date range 3/24/2013&amp;nbsp; 3/24/2010&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not entirely certain it is possible to do via an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 19:55:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402193#M559574</guid>
      <dc:creator />
      <dc:date>2013-04-25T19:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr and total with date ranges</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402194#M559575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you send me a copy of the file and I will have a look, I am trying to learn as much as I can so I want to help, it's the only way I can learn quickly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 20:26:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402194#M559575</guid>
      <dc:creator>rustyfishbones</dc:creator>
      <dc:date>2013-04-25T20:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr and total with date ranges</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402195#M559576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try to resolve the logic in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have the dates, and you can get the weeks with week(Date), so you can count new customers grouping by weeks if that's what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would add a column as a Flag to new customers, after that, you only need at the straight table an expression like sum(FlagNewCustomer) using that flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps&lt;/P&gt;&lt;P&gt;I would need more details to help yo with the logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 20:43:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-and-total-with-date-ranges/m-p/402195#M559576</guid>
      <dc:creator />
      <dc:date>2013-04-25T20:43:23Z</dc:date>
    </item>
  </channel>
</rss>

