<?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: FirstSortedValue and Aggr in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029159#M84789</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created measure&amp;nbsp; at the beginning excatly the same as you wrote, but I need to create dimension for my chart.&lt;/P&gt;
&lt;P&gt;Because of that I tried this with Aggr:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=FirstSortedValue({&amp;lt;[Project_History_Field]={"Project_Status"}&amp;gt;}[Project_History_Value],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Aggr(Max([Historical_field_change_date]),Project_History_Field))&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;but it does not works on chart.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Any other idea?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 09:08:33 GMT</pubDate>
    <dc:creator>SingSing16</dc:creator>
    <dc:date>2023-01-24T09:08:33Z</dc:date>
    <item>
      <title>FirstSortedValue and Aggr</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2028803#M84766</link>
      <description>&lt;P&gt;I have issue with creation of dimension including FirstSortedValue as well Aggr.&lt;BR /&gt;I already created some measure including value which I am interested but in this case I need to create chart including this values as dimension.&lt;/P&gt;
&lt;TABLE border="1" width="76.56249638592116%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="25px"&gt;Project_Number&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;Project_History_Field&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;Project_History_Value&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;Historical_field_change_date&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P123&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Not started&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2022-10-11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P123&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Username&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Lisa M.&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2020-12-17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P123&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;In progress&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2023-01-02&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;On-hold&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2023-01-15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P789`&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Stage&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Review&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2020-11-15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P789&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;In progress&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2020-12-28&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="24px"&gt;P789&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Project_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Cancelled&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;2021-12-12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to gain only one Project_History_Value&amp;nbsp; according to Project_Status&amp;nbsp;(in Project_History_Field) for single Project_Number according to the newst date.&lt;/P&gt;
&lt;P&gt;I tried to create dimension according to this:&lt;/P&gt;
&lt;P&gt;=FirstSortedValue({&amp;lt;[Project_History_Field]={"Project_Status"}&amp;gt;}[Project_History_Value],&lt;BR /&gt;-Aggr(Max([Historical_field_change_date]),Project_History_Field))&lt;/P&gt;
&lt;P&gt;Formally it works but but doesn't if I want to create table or chart with it.&lt;/P&gt;
&lt;P&gt;Please help me.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 13:01:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2028803#M84766</guid>
      <dc:creator>SingSing16</dc:creator>
      <dc:date>2023-01-23T13:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and Aggr</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029067#M84784</link>
      <description>&lt;P&gt;Will this work?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KGalloway_0-1674512796909.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98670iA3CF75D9C2FAD9E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KGalloway_0-1674512796909.png" alt="KGalloway_0-1674512796909.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I edited your formula slightly and used&amp;nbsp;&lt;STRONG&gt;FirstSortedValue({&amp;lt;[Project_History_Field]={"Project_Status"}&amp;gt;}[Project_History_Value],-[Historical_field_change_date])&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 22:27:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029067#M84784</guid>
      <dc:creator>KGalloway</dc:creator>
      <dc:date>2023-01-23T22:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and Aggr</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029159#M84789</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created measure&amp;nbsp; at the beginning excatly the same as you wrote, but I need to create dimension for my chart.&lt;/P&gt;
&lt;P&gt;Because of that I tried this with Aggr:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=FirstSortedValue({&amp;lt;[Project_History_Field]={"Project_Status"}&amp;gt;}[Project_History_Value],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Aggr(Max([Historical_field_change_date]),Project_History_Field))&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;but it does not works on chart.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Any other idea?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 09:08:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029159#M84789</guid>
      <dc:creator>SingSing16</dc:creator>
      <dc:date>2023-01-24T09:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and Aggr</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029381#M84797</link>
      <description>&lt;P&gt;What about adding fields in the load script to identify the most recent changed record and then apply its status to all of the records for that project as a new field?&lt;/P&gt;
&lt;P&gt;raw:&lt;BR /&gt;load * inline [&lt;BR /&gt;Project_Number, Project_History_Field, Project_History_Value, Historical_field_change_date&lt;BR /&gt;P123, Project_Status, Not started, 2022-10-11&lt;BR /&gt;P123, Username, Lisa M., 2020-12-17&lt;BR /&gt;P123, Project_Status, In progress, 2023-01-02&lt;BR /&gt;P456, Project_Status, On-hold, 2023-01-15&lt;BR /&gt;P789, Project_Stage, Review, 2020-11-15&lt;BR /&gt;P789, Project_Status, In progress, 2020-12-28&lt;BR /&gt;P789, Project_Status, Cancelled, 2021-12-12&lt;/P&gt;
&lt;P&gt;]&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;left Join&lt;BR /&gt;load&lt;BR /&gt;Project_Number,&lt;BR /&gt;max(Historical_field_change_date) as Most_Recent_Change_Date&lt;BR /&gt;resident raw&lt;BR /&gt;where Project_History_Field = 'Project_Status'&lt;BR /&gt;group by Project_Number;&lt;/P&gt;
&lt;P&gt;left join&lt;BR /&gt;Load&lt;BR /&gt;Project_Number,&lt;BR /&gt;Project_History_Value as Most_Recent_Status&lt;BR /&gt;resident raw&lt;BR /&gt;where Historical_field_change_date = Most_Recent_Change_Date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gave me the following table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KGalloway_0-1674570783205.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98734iBB1A42C06406F476/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KGalloway_0-1674570783205.png" alt="KGalloway_0-1674570783205.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 14:33:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029381#M84797</guid>
      <dc:creator>KGalloway</dc:creator>
      <dc:date>2023-01-24T14:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and Aggr</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029677#M84818</link>
      <description>&lt;P&gt;to create a calculated dimension wrap the expression in Aggr() as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=&lt;STRONG&gt;Aggr&lt;/STRONG&gt;(FirstSortedValue({&amp;lt;Project_History_Field={'Project_Status'}&amp;gt;} Project_History_Value,-Historical_field_change_date),&lt;STRONG&gt;Project_Number)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 06:42:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-and-Aggr/m-p/2029677#M84818</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2023-01-25T06:42:06Z</dc:date>
    </item>
  </channel>
</rss>

