<?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 RangeSum and Aggregate Combination Failing? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070369#M1223599</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;I have a simple table with 1 dimension and 1 measure. The dimension is calendar days and named&amp;nbsp;&lt;U&gt;entitlement_event_date&lt;/U&gt;. The measure is calculating revenue increase (positive values) or decrease (negative values) for that day. The expression used is:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))&lt;/LI-CODE&gt;
&lt;P&gt;The result looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.51.20.png" style="width: 184px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106966iB5C8CDCF348FE0D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.51.20.png" alt="Screenshot 2023-05-11 at 21.51.20.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is step nr. 1.&lt;/P&gt;
&lt;P&gt;Now, in a second step, I'd like to see the accumulated value from the beginning up, so I do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno()))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.53.42.png" style="width: 279px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106969i1B99FEF91E9A926D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.53.42.png" alt="Screenshot 2023-05-11 at 21.53.42.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Up to this point, everything works very well as expected.&lt;/P&gt;
&lt;P&gt;Now to the challenge. As a next step, I'd like to bring in a new dimension (not visible in the table but for the calculation) because I want to do the calculation not globally but for each customer individually in order to be able to then only look at those customers where the revenue is decreasing, so I changed my expression to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(aggr(

if(

rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno())) &amp;lt; 0,

rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno()))

)

, customer_short))&lt;/LI-CODE&gt;
&lt;P&gt;However, the result is not what I like to see:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.56.24.png" style="width: 375px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106971i5575FE0C43AC1F8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.56.24.png" alt="Screenshot 2023-05-11 at 21.56.24.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should actually look the same as nr. 2 but with the positive values being NULL (only the first 3 shown) because currently there's exactly one customer selected as a selection (no other selections). In the end, I want to see all the negative customers and only them summed up when I remove all selections.&lt;/P&gt;
&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2023 20:00:53 GMT</pubDate>
    <dc:creator>Stedi</dc:creator>
    <dc:date>2023-05-11T20:00:53Z</dc:date>
    <item>
      <title>RangeSum and Aggregate Combination Failing?</title>
      <link>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070369#M1223599</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;I have a simple table with 1 dimension and 1 measure. The dimension is calendar days and named&amp;nbsp;&lt;U&gt;entitlement_event_date&lt;/U&gt;. The measure is calculating revenue increase (positive values) or decrease (negative values) for that day. The expression used is:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))&lt;/LI-CODE&gt;
&lt;P&gt;The result looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.51.20.png" style="width: 184px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106966iB5C8CDCF348FE0D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.51.20.png" alt="Screenshot 2023-05-11 at 21.51.20.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is step nr. 1.&lt;/P&gt;
&lt;P&gt;Now, in a second step, I'd like to see the accumulated value from the beginning up, so I do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno()))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.53.42.png" style="width: 279px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106969i1B99FEF91E9A926D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.53.42.png" alt="Screenshot 2023-05-11 at 21.53.42.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Up to this point, everything works very well as expected.&lt;/P&gt;
&lt;P&gt;Now to the challenge. As a next step, I'd like to bring in a new dimension (not visible in the table but for the calculation) because I want to do the calculation not globally but for each customer individually in order to be able to then only look at those customers where the revenue is decreasing, so I changed my expression to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(aggr(

if(

rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno())) &amp;lt; 0,

rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno()))

)

, customer_short))&lt;/LI-CODE&gt;
&lt;P&gt;However, the result is not what I like to see:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2023-05-11 at 21.56.24.png" style="width: 375px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106971i5575FE0C43AC1F8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-05-11 at 21.56.24.png" alt="Screenshot 2023-05-11 at 21.56.24.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should actually look the same as nr. 2 but with the positive values being NULL (only the first 3 shown) because currently there's exactly one customer selected as a selection (no other selections). In the end, I want to see all the negative customers and only them summed up when I remove all selections.&lt;/P&gt;
&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 20:00:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070369#M1223599</guid>
      <dc:creator>Stedi</dc:creator>
      <dc:date>2023-05-11T20:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: RangeSum and Aggregate Combination Failing?</title>
      <link>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070377#M1223600</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/229810"&gt;@Stedi&lt;/a&gt;&amp;nbsp; not sure how would you like your accumulation with second dimension as I don't have sample to work on but you could try below&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;aggr(rangesum(above(
sum(if((entitlement_event_type = 'Start' or entitlement_event_type = 'End')
and entitlement_event_date &amp;gt;= Yearstart(ReloadTime())
and customer_since &amp;lt; '2023-01-01', event_price))
, 0, rowno())), customer_short)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 May 2023 20:31:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070377#M1223600</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-11T20:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: RangeSum and Aggregate Combination Failing?</title>
      <link>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070581#M1223604</link>
      <description>&lt;P&gt;Don't I need to sum the aggr so that I have one value representing the sum of all customers being negative instead of an array of values, one per customer?&lt;/P&gt;
&lt;P&gt;I think that's exactly what I've tried in my third attempt but it doesn't work.&lt;/P&gt;
&lt;P&gt;How can I provide a sample?&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 10:16:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeSum-and-Aggregate-Combination-Failing/m-p/2070581#M1223604</guid>
      <dc:creator>Stedi</dc:creator>
      <dc:date>2023-05-12T10:16:05Z</dc:date>
    </item>
  </channel>
</rss>

