<?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 Sum value per every dimension with latest date in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422375#M95795</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a table with sum of values per every dimension for latest date per dim. The aim is to present the full picture of latest positions.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Sort, Date, Value&lt;/P&gt;
&lt;P&gt;1, 18.02.2024, 100&lt;/P&gt;
&lt;P&gt;1, 19.02.2024, 200&lt;/P&gt;
&lt;P&gt;1, 20.02.2024, 300&lt;/P&gt;
&lt;P&gt;2, 18.02.2024, 400&lt;/P&gt;
&lt;P&gt;2, 20.02.2024, 500&lt;/P&gt;
&lt;P&gt;3, 10.02.2024, 600&lt;/P&gt;
&lt;P&gt;&amp;nbsp; When selecting Date = 19.02.2024 I will get the Value = 200, but I want to show sum of latest values per every Sort: Value = 200 (for Sort1) + 400 (for Sort2) + 600 (for Sort3).&lt;/P&gt;
&lt;P&gt;I have managed to succeed to the point that I can have the latest possible Dates (&amp;lt;= selected Date) with function:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Max({&amp;lt;Date= p({&amp;lt;Date={"&amp;lt;=$(=Max(Date))"} &amp;gt;}Date)&amp;gt;} Date),&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;however I am failing to have it aggregated by Sort to get the correct sum(Value).&lt;/P&gt;
&lt;P&gt;Appreciate your help on this.&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;</description>
    <pubDate>Thu, 22 Feb 2024 14:24:09 GMT</pubDate>
    <dc:creator>justalkak</dc:creator>
    <dc:date>2024-02-22T14:24:09Z</dc:date>
    <item>
      <title>Sum value per every dimension with latest date</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422375#M95795</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a table with sum of values per every dimension for latest date per dim. The aim is to present the full picture of latest positions.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Sort, Date, Value&lt;/P&gt;
&lt;P&gt;1, 18.02.2024, 100&lt;/P&gt;
&lt;P&gt;1, 19.02.2024, 200&lt;/P&gt;
&lt;P&gt;1, 20.02.2024, 300&lt;/P&gt;
&lt;P&gt;2, 18.02.2024, 400&lt;/P&gt;
&lt;P&gt;2, 20.02.2024, 500&lt;/P&gt;
&lt;P&gt;3, 10.02.2024, 600&lt;/P&gt;
&lt;P&gt;&amp;nbsp; When selecting Date = 19.02.2024 I will get the Value = 200, but I want to show sum of latest values per every Sort: Value = 200 (for Sort1) + 400 (for Sort2) + 600 (for Sort3).&lt;/P&gt;
&lt;P&gt;I have managed to succeed to the point that I can have the latest possible Dates (&amp;lt;= selected Date) with function:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Max({&amp;lt;Date= p({&amp;lt;Date={"&amp;lt;=$(=Max(Date))"} &amp;gt;}Date)&amp;gt;} Date),&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;however I am failing to have it aggregated by Sort to get the correct sum(Value).&lt;/P&gt;
&lt;P&gt;Appreciate your help on this.&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;</description>
      <pubDate>Thu, 22 Feb 2024 14:24:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422375#M95795</guid>
      <dc:creator>justalkak</dc:creator>
      <dc:date>2024-02-22T14:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sum value per every dimension with latest date</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422433#M95806</link>
      <description>&lt;P&gt;You can get the latest values for every Sort using this expression:&lt;/P&gt;
&lt;PRE&gt;{&amp;lt;Date={"&amp;lt;=$(=Max(Date))"}&amp;gt;} FirstSortedValue(Value, -Date)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LRuCelver_2-1708614502442.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160443i79EA00A0461F4CC8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LRuCelver_2-1708614502442.png" alt="LRuCelver_2-1708614502442.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;(I set the measure's total function to Sum to get the 1200 in the Total row of the table)&lt;/P&gt;
&lt;P&gt;To calculate the sum of these as a single value you can use this expression:&lt;/P&gt;
&lt;PRE&gt;{&amp;lt;Date={"&amp;lt;=$(=Max(Date))"}&amp;gt;} Sum(Aggr(FirstSortedValue(Value, -Date), Sort))&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LRuCelver_3-1708614550620.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160445i8347F1F852CCBE29/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LRuCelver_3-1708614550620.png" alt="LRuCelver_3-1708614550620.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is the script I used to load the data:&lt;/P&gt;
&lt;PRE&gt;Data:&lt;BR /&gt;NoConcatenate Load&lt;BR /&gt;    Sort,&lt;BR /&gt;    Date(Date#(Date, 'DD.MM.YYYY')) as Date,&lt;BR /&gt;    Value&lt;BR /&gt;Inline [&lt;BR /&gt;    Sort, Date, Value&lt;BR /&gt;    1, 18.02.2024, 100&lt;BR /&gt;    1, 19.02.2024, 200&lt;BR /&gt;    1, 20.02.2024, 300&lt;BR /&gt;    2, 18.02.2024, 400&lt;BR /&gt;    2, 20.02.2024, 500&lt;BR /&gt;    3, 10.02.2024, 600&lt;BR /&gt;];&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2024 15:10:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422433#M95806</guid>
      <dc:creator>LRuCelver</dc:creator>
      <dc:date>2024-02-22T15:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sum value per every dimension with latest date</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422467#M95807</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285770"&gt;@LRuCelver&lt;/a&gt;&amp;nbsp;his solution is good, i also found this solution intresting:&lt;/P&gt;
&lt;PRE&gt;Example:&lt;BR /&gt;&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Sort, Date, Value&lt;BR /&gt;1, 18.02.2024, 100&lt;BR /&gt;1, 19.02.2024, 200&lt;BR /&gt;1, 20.02.2024, 300&lt;BR /&gt;2, 18.02.2024, 400&lt;BR /&gt;2, 20.02.2024, 500&lt;BR /&gt;3, 10.02.2024, 600&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;MAP_Flag:&lt;BR /&gt;MAPPING Load Sort &amp;amp; '-' &amp;amp; Date(min(Date), 'dd.MM.YYYY'),&lt;BR /&gt;&lt;SPAN&gt; 1 AS Flag&lt;/SPAN&gt;&lt;BR /&gt;Resident Example&lt;BR /&gt;Group by Sort;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NoConcatenate&lt;BR /&gt;TEMP:&lt;BR /&gt;Load *,&lt;BR /&gt;&amp;nbsp;APPLYMAP('MAP_Flag', Sort&amp;nbsp; &amp;amp; '-' &amp;amp; Date, 0) AS Flag&lt;BR /&gt;RESIDENT Example;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE Example;&lt;BR /&gt;Rename Table TEMP TO Example;&lt;/PRE&gt;
&lt;DIV&gt;And a little bit of Set Analysis:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;Sum({&amp;lt;Flag = {1}, Date=&amp;gt;} Value)&lt;BR /&gt;+&lt;BR /&gt;Sum({&amp;lt;Date= {"$(= Replace(GetFieldSelections( Date, ', ', 10000), ', ', chr(39) &amp;amp; ',' &amp;amp; chr(39)))"}&amp;gt;}Value)&lt;BR /&gt;-&lt;BR /&gt;IF(GetSelectedCount(Date) =0,&lt;BR /&gt;0,&lt;BR /&gt;Sum({&amp;lt;Flag = {1}, Date=, Sort = {$(=concat(distinct chr(39)&amp;amp;Sort&amp;amp;chr(39), ','))}&amp;gt;}Value))&lt;/PRE&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhanThanhSon_0-1708617804937.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160450iDB3905006534B52D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhanThanhSon_0-1708617804937.png" alt="PhanThanhSon_0-1708617804937.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhanThanhSon_2-1708617840391.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160452i4D1117DE11320EF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhanThanhSon_2-1708617840391.png" alt="PhanThanhSon_2-1708617840391.png" /&gt;&lt;/span&gt;
&lt;P&gt;So my solution is a little bit more complex, but u dont have to use a aggr function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards Son&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Feb 2024 16:04:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2422467#M95807</guid>
      <dc:creator>PhanThanhSon</dc:creator>
      <dc:date>2024-02-22T16:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum value per every dimension with latest date</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2424161#M95971</link>
      <description>&lt;P&gt;Actually, I have met another problem and now I think it is inevitable to move the calculation to script..;/ but maybe you can enlighten me with it. Is there any possibility to impose on other fields in the front end to be filtered according to what we calculate with the firstsortedvalue? I mean let's say we have other dims for our initial data:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sort, Date, Value, ID, Colour&lt;/P&gt;
&lt;P&gt;1, 18.02.2024, 100, 1, red,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1, 19.02.2024, 200, 2, blue&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1, 20.02.2024, 300, 3, black&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2, 18.02.2024, 400, 4, red&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;2, 20.02.2024, 500, 5, yellow&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3, 10.02.2024, 600, 6, pink&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Is there any way to filter whole data with all the IDs that go into calculation for 19th Feb (ID 2,4,6) on the point of selecting date = 19.02? Tricky.. and I guess not possible?&lt;/P&gt;
&lt;P&gt;Thanks&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;</description>
      <pubDate>Tue, 27 Feb 2024 14:47:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-value-per-every-dimension-with-latest-date/m-p/2424161#M95971</guid>
      <dc:creator>justalkak</dc:creator>
      <dc:date>2024-02-27T14:47:50Z</dc:date>
    </item>
  </channel>
</rss>

