<?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: Cumulative sum over dynamic range in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522584#M37480</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37117"&gt;@hico-mah&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;This would make date selection easy but will double-count users because Distinct would not work.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Michael -&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think that is true...&amp;nbsp; I believe you should still be able to do a DISTINCT count. Let me give it a shot. I am going to try this in QlikView, but it should stay the same for Sense&lt;/P&gt;</description>
    <pubDate>Wed, 19 Dec 2018 13:10:33 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-12-19T13:10:33Z</dc:date>
    <item>
      <title>Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522573#M37475</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm tasked with the job on creating a cumulative sum over a dynamic time range.&lt;/P&gt;&lt;P&gt;Let's assume my customer has a list of users that are active on a daily basis. He now wants to know how many distinct users in total have been active - but through a dynamic time range:&lt;/P&gt;&lt;P&gt;Assuming these data&lt;/P&gt;&lt;PRE&gt;data:LOAD * INLINE [
Date, User
2018-01-01, A
2018-01-02, B
2018-01-05, A
2018-01-05, C
2018-02-03, A
2018-02-03, C
2018-02-08, D
2018-02-10, A
2018-02-12, C
](delimiter is ',');&lt;/PRE&gt;&lt;P&gt;Assuming if today is March 2018 and a YTD value is shown, the customer expects the following outcome:&lt;/P&gt;&lt;P&gt;&amp;nbsp;2018-01-01 --&amp;gt; user A --&amp;gt; 1&lt;/P&gt;&lt;P&gt;2018-01-02 --&amp;gt; users A, B --&amp;gt; 2&lt;/P&gt;&lt;P&gt;2018-01-05 --&amp;gt; users A, B, C --&amp;gt; 3&lt;/P&gt;&lt;P&gt;2018-02-03 --&amp;gt; users A, B, C --&amp;gt; 3&lt;/P&gt;&lt;P&gt;2018-02-08 --&amp;gt; users A, B, C, D --&amp;gt; 4 (same for 2018-02-10, 2018-02-12)&lt;/P&gt;&lt;P&gt;If the user would now select the previous months as range, January should be forgotten, so the expected results would be:&lt;/P&gt;&lt;P&gt;2018-03-02 --&amp;gt; users A, C --&amp;gt; 2&lt;/P&gt;&lt;P&gt;2018-03-08 --&amp;gt; users A, C, D --&amp;gt; 3 (same again true for the rest of the data)&lt;/P&gt;&lt;P&gt;Notice that user B is now missing as user B was only active in January.&lt;/P&gt;&lt;P&gt;I created a solution working for the overall time range with previous() and a marker row and I'm pretty sure that I could solve those issues, but I would need one marker row for each time range the customer uses - and they use a lot: R3, R6, R12, 12 weeks... .&lt;/P&gt;&lt;P&gt;Therefore: has anybody an intelligent generic solution or is one marker row for each time range necessary? Luckily the customer's reference frame is fixed, meaning that in December R3 will be the last completed three months, i.e. Nov, Oct, Sep. . The user is not free to look at the last 3 months starting in April.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:00:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522573#M37475</guid>
      <dc:creator>hico-mah</dc:creator>
      <dc:date>2024-11-16T07:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522575#M37476</link>
      <description>&lt;P&gt;I think what you need here is&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;The As Of Table&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 12:46:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522575#M37476</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-19T12:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522583#M37479</link>
      <description>Hi Sunny, I thought of this too, but I'm afraid that will not fix my problem. This would make date selection easy but will double-count users because Distinct would not work.&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:05:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522583#M37479</guid>
      <dc:creator>hico-mah</dc:creator>
      <dc:date>2018-12-19T13:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522584#M37480</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37117"&gt;@hico-mah&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;This would make date selection easy but will double-count users because Distinct would not work.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Michael -&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think that is true...&amp;nbsp; I believe you should still be able to do a DISTINCT count. Let me give it a shot. I am going to try this in QlikView, but it should stay the same for Sense&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:10:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522584#M37480</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-19T13:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522594#M37481</link>
      <description>&lt;P&gt;Check this out&lt;/P&gt;&lt;P&gt;Script&lt;/P&gt;&lt;PRE&gt;data:
LOAD *,
	 MonthName(Date) as MonthYear;
LOAD * INLINE [
    Date, User
    2018-01-01, A
    2018-01-02, B
    2018-01-05, A
    2018-01-05, C
    2018-02-03, A
    2018-02-03, C
    2018-02-08, D
    2018-02-10, A
    2018-02-12, C
];

MinDate:
LOAD Min(Date) as MinDate
Resident data;

LET vMinDate = Peek('MinDate');
TRACE $(vMinDate);
DROP Table MinDate;

AsOfTable:
LOAD DISTINCT Date as AsOfDate,
	 MonthName(Date) as AsOfMonthYear,
	 Date(Date - IterNo() + 1) as Date,
	 (IterNo() - 1) as DaysBack
Resident data
While Date - IterNo() + 1 &amp;gt;= $(vMinDate);&lt;/PRE&gt;&lt;P&gt;Dimension&lt;/P&gt;&lt;PRE&gt;AsOfDate&lt;/PRE&gt;&lt;P&gt;Expression&lt;/P&gt;&lt;PRE&gt;=Count(DISTINCT {&amp;lt;MonthYear = p(AsOfMonthYear)&amp;gt;} User)&lt;/PRE&gt;&lt;P&gt;When no selection is made&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 456px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/2424i119512D874B3840C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When you select Feb-2018 in AsOfMonthYear&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 439px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/2425i3063056AE9D7FFF3/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:33:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1522594#M37481</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-19T13:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum over dynamic range</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1527896#M37924</link>
      <description>&lt;P&gt;Perfect, I finally got an use case for p in set analysis!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 15:47:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-over-dynamic-range/m-p/1527896#M37924</guid>
      <dc:creator>hico-mah</dc:creator>
      <dc:date>2019-01-08T15:47:29Z</dc:date>
    </item>
  </channel>
</rss>

