<?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 Get last value within each group based on date in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Get-last-value-within-each-group-based-on-date/m-p/1878291#M72405</link>
    <description>&lt;P&gt;I have the following table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;user_id   level   date
1          0      2021-01-01
1          1      2021-01-15
1          0      2021-02-01
2          1      2021-01-01
2          2      2021-02-17
3          2      2021-03-15
3          0      2021-04-13
4          1      2021-01-01&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note the dates correspond to a change in the level i.e the last "level" recorded is their current level. I want to calculate how many there's in each level (theres level 0,1,2 and 3) i.e I need for each "user_id" get the last "level" value recorded which in the example above would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;level   count
0        2     #user_id=1,3
1        1     #user_id=4
2        1     #user_id=2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jan 2022 08:33:31 GMT</pubDate>
    <dc:creator>jakobjensen</dc:creator>
    <dc:date>2022-01-07T08:33:31Z</dc:date>
    <item>
      <title>Get last value within each group based on date</title>
      <link>https://community.qlik.com/t5/App-Development/Get-last-value-within-each-group-based-on-date/m-p/1878291#M72405</link>
      <description>&lt;P&gt;I have the following table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;user_id   level   date
1          0      2021-01-01
1          1      2021-01-15
1          0      2021-02-01
2          1      2021-01-01
2          2      2021-02-17
3          2      2021-03-15
3          0      2021-04-13
4          1      2021-01-01&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note the dates correspond to a change in the level i.e the last "level" recorded is their current level. I want to calculate how many there's in each level (theres level 0,1,2 and 3) i.e I need for each "user_id" get the last "level" value recorded which in the example above would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;level   count
0        2     #user_id=1,3
1        1     #user_id=4
2        1     #user_id=2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 08:33:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-last-value-within-each-group-based-on-date/m-p/1878291#M72405</guid>
      <dc:creator>jakobjensen</dc:creator>
      <dc:date>2022-01-07T08:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get last value within each group based on date</title>
      <link>https://community.qlik.com/t5/App-Development/Get-last-value-within-each-group-based-on-date/m-p/1878432#M72417</link>
      <description>&lt;P&gt;Hi, for the count you can use:&lt;/P&gt;
&lt;P&gt;Sum(Aggr(If(date=max(TOTAL &amp;lt;user_id&amp;gt; date), 1,0),level,date,user_id))&lt;/P&gt;
&lt;P&gt;For the text with users id's:&lt;/P&gt;
&lt;P&gt;='#user_id=' &amp;amp; Concat(DISTINCT Aggr(If(date=max(TOTAL &amp;lt;user_id&amp;gt; date), user_id),level,date,user_id),',')&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 12:38:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-last-value-within-each-group-based-on-date/m-p/1878432#M72417</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-01-07T12:38:14Z</dc:date>
    </item>
  </channel>
</rss>

