<?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: Aggregate to make calculation dynamical in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83187#M13643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your suggestions.&lt;/P&gt;&lt;P&gt;I ended up using this syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(aggr(count({$&amp;lt;Date={"&amp;gt;=$(=&lt;SPAN style="font-size: 13.3333px;"&gt;vMaxDate&lt;/SPAN&gt;)"}, Transdatum={"&amp;lt;=$(=vMaxDate)"}&amp;gt;} distinct &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14.6667px;"&gt;TRANSNUMBER&lt;/SPAN&gt;),PERSONID)&amp;gt;=12,1,0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it was similar to what you suggested Liron Baram but another order with if-statement.&lt;/P&gt;&lt;P&gt;Also I created variables for timeperiod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Jun 2018 21:18:37 GMT</pubDate>
    <dc:creator>annabergendal</dc:creator>
    <dc:date>2018-06-11T21:18:37Z</dc:date>
    <item>
      <title>Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83178#M13634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="font-size: 11pt;"&gt;I have a dataset with transactions per person.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;I would like to know how many people have more than 12 transactions last 13 months, lets call them “frequent buyers”.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;I managed to precalculate number of transactions last 13 months in the script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;PERSONID,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;count(distinct TRANSNUMBER) as Total&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;Resident&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;FactTransaction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;where Date &amp;gt;= addmonths(today(),-13)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;group by &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;PERSONID;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;And then use it in the set analysys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;count({$&amp;lt;Total ={"&amp;gt;=12"}&amp;gt;} distinct PERSONID)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;Only problem is that I need it dynamically, calculated front-end, so that the user can select a year-month and have it calculated 13 months back from that time period...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;I need to do some aggregation I guess, and ideas how?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:00:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83178#M13634</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2018-06-11T13:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83179#M13635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;PERSONID = {"=Count({&amp;lt;Date = {[$(='&amp;gt;=' &amp;amp; Date(AddMonths(Max(Date), -13), 'DateFieldFormatHere') &amp;amp; '&amp;lt;=' &amp;amp; Date(Max(Date), 'DateFieldFormatHere'))]}&amp;gt;}&lt;STRONG style="color: #ff0000;"&gt;DISTINCT &lt;/STRONG&gt;TRANSNUMBER) &amp;gt;= 12"}&amp;gt;} DISTINCT PERSONID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Updated the inner count to include Distinct count the transnumber just like your script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:18:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83179#M13635</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-11T13:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83180#M13636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;something in this lines should work for you &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14.6667px;"&gt;sum(aggr(if({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14.6667px;"&gt;Date ={"&amp;gt;= $(=addmonths(max(Date),-13))"&lt;/SPAN&gt;&amp;gt;}&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14.6667px;"&gt;count(distinct TRANSNUMBER)&amp;gt;12,1,0)&lt;/SPAN&gt; ,PERSONID))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:23:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83180#M13636</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2018-06-11T13:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83181#M13637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This one gave me simply "0", maybe I made som syntax error...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83181#M13637</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2018-06-11T13:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83182#M13638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Syntax error after "if", can you really include if in set analysis?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:49:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83182#M13638</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2018-06-11T13:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83183#M13639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share an image of the expression you used?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:50:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83183#M13639</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-11T13:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83184#M13640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a copy of your expression, I need to check format of date maybe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:53:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83184#M13640</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2018-06-11T13:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83185#M13641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;It's a copy of your expression&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure I understand.... I was looking for an image of the expression in the expression editor from your app&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:56:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83185#M13641</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-11T13:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83186#M13642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this simple approach fits better:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(&lt;SPAN style="font-size: 11.0pt;"&gt;count(distinct TRANSNUMBER)&amp;gt;=12&lt;/SPAN&gt;, &lt;SPAN style="font-size: 11.0pt;"&gt;count(distinct PERSONID))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:34:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83186#M13642</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-06-11T14:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregate to make calculation dynamical</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83187#M13643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your suggestions.&lt;/P&gt;&lt;P&gt;I ended up using this syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(aggr(count({$&amp;lt;Date={"&amp;gt;=$(=&lt;SPAN style="font-size: 13.3333px;"&gt;vMaxDate&lt;/SPAN&gt;)"}, Transdatum={"&amp;lt;=$(=vMaxDate)"}&amp;gt;} distinct &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 14.6667px;"&gt;TRANSNUMBER&lt;/SPAN&gt;),PERSONID)&amp;gt;=12,1,0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it was similar to what you suggested Liron Baram but another order with if-statement.&lt;/P&gt;&lt;P&gt;Also I created variables for timeperiod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 21:18:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregate-to-make-calculation-dynamical/m-p/83187#M13643</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2018-06-11T21:18:37Z</dc:date>
    </item>
  </channel>
</rss>

