<?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 YTD Calculation in Line Chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2499407#M102986</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/324206"&gt;@InsightSeeker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the following expression to obtain the desired output:&lt;/P&gt;
&lt;P&gt;Aggr(RangeSum(Above(count(IncidentID), 0, RowNo())), Year,[%Key_Date])&lt;/P&gt;</description>
    <pubDate>Fri, 27 Dec 2024 06:06:54 GMT</pubDate>
    <dc:creator>pallavi_96</dc:creator>
    <dc:date>2024-12-27T06:06:54Z</dc:date>
    <item>
      <title>Cumulative YTD Calculation in Line Chart</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2499378#M102980</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I would like to create a visualisation in Qlik Sense that calculates the cumulative number of incidents for each year. What sounds simple at first, presents me with major challenges when developing a suitable key figure. The following criteria must be covered by the formula of the key figure:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The calculation should start from zero on 1 January of each year&lt;/LI&gt;
&lt;LI&gt;The number of incidents (Count(IncidentID)) must be calculated cumulatively within a year&lt;/LI&gt;
&lt;LI&gt;The key figure must be presented in the form of a line chart&lt;/LI&gt;
&lt;LI&gt;A drill-down dimension with year, month and date serves as the dimension&lt;/LI&gt;
&lt;LI&gt;The value must not change if a date is selected&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Two tables are available as a database for this, which I have mimicked in the attached sample application. One table, ‘Calendar’, contains the relevant date fields, while the ‘Incidents’ table contains the unique IDs of the incidents.&lt;BR /&gt;&lt;BR /&gt;So far I have tested the following formula:&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;RangeSum(Above(Count(IncidentID),0,RowNo()))&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;The result is already very close to the target - the only problem is that the calculation does not start from zero on 1 January each year. Addtionally, it is calculated dynamically in the case of date selections.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="InsightSeeker_0-1735237431356.png" style="width: 769px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176069iF2B9FC0966DFD74E/image-dimensions/769x295?v=v2" width="769" height="295" role="button" title="InsightSeeker_0-1735237431356.png" alt="InsightSeeker_0-1735237431356.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a result, based on the sample data, I expect the chart to show 6 as the cumulative number of incidents for 31/12/2023, 0 as the cumulative number for 01/01/2024 and 8 as the cumulative number for 14/02/2024, for example.&lt;/P&gt;
&lt;P&gt;I would be pleased if someone could help me. Many thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 18:24:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2499378#M102980</guid>
      <dc:creator>InsightSeeker</dc:creator>
      <dc:date>2024-12-26T18:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative YTD Calculation in Line Chart</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2499407#M102986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/324206"&gt;@InsightSeeker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the following expression to obtain the desired output:&lt;/P&gt;
&lt;P&gt;Aggr(RangeSum(Above(count(IncidentID), 0, RowNo())), Year,[%Key_Date])&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 06:06:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2499407#M102986</guid>
      <dc:creator>pallavi_96</dc:creator>
      <dc:date>2024-12-27T06:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative YTD Calculation in Line Chart</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2500288#M103103</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/102068"&gt;@pallavi_96&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's me again. I've returned to work after the holidays and wanted to use your solution, which worked great with the sample data. Unfortunately, I ran into two major problems:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The formula does not work correctly when using a time-based drilldown dimension in the line chart (year, month, day) - see image: result if the dimension is at monthly level. Again, at monthly level the&amp;nbsp;calculation should start from zero on 1 January of each year but only display the accumulated number of incidents at the end of the month. Based on the example data provided, I would expect 6 as the result for January and 8 as the cumulative number for February.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="InsightSeeker_2-1736280349844.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176244i844B1A6C5B14D820/image-size/large?v=v2&amp;amp;px=999" role="button" title="InsightSeeker_2-1736280349844.png" alt="InsightSeeker_2-1736280349844.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;The formula performs poorly with larger amounts of data - I suspect this is due to the Aggr() function&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Can you please provide further support in the form of an adapted formula or an alternative approach? Or maybe someone else?&lt;/P&gt;
&lt;P&gt;Thanks again in advance! Best regards.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 20:14:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-YTD-Calculation-in-Line-Chart/m-p/2500288#M103103</guid>
      <dc:creator>InsightSeeker</dc:creator>
      <dc:date>2025-01-07T20:14:01Z</dc:date>
    </item>
  </channel>
</rss>

