<?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 Returning data based on Max Value in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504969#M14558</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I'm porting some QV documents to QS, and we have an automated QV task that dumps a chart to a .qvd&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I understand it, this functionality doesn't exist in QS, and so I need to do it within the load script and store the table as a qvd (I presume)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The try and describe the issue, we produce our products across various sites, and I need to ascertain when &amp;amp; where it was last produced.&lt;/P&gt;
&lt;P&gt;e.g for the below table:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="3" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Product&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Location&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;ProdDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;London&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5555&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20250101&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My output should appear to be like:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="3" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Product&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;LastProduced&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;LastProduceDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5555&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20250101&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In QV, our table just has&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Product&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LastProduced =&amp;nbsp;&lt;/STRONG&gt;FirstSortedValue(distinct Company,-[Date])&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LastProducedDate =&amp;nbsp;&lt;/STRONG&gt;date(Max (Date),'YYYYMMDD')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when done in a load script, I get a row for "London" and one for "Paris"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas on how I can achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2025 15:36:26 GMT</pubDate>
    <dc:creator>Oggy172</dc:creator>
    <dc:date>2025-02-07T15:36:26Z</dc:date>
    <item>
      <title>Returning data based on Max Value</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504969#M14558</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I'm porting some QV documents to QS, and we have an automated QV task that dumps a chart to a .qvd&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I understand it, this functionality doesn't exist in QS, and so I need to do it within the load script and store the table as a qvd (I presume)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The try and describe the issue, we produce our products across various sites, and I need to ascertain when &amp;amp; where it was last produced.&lt;/P&gt;
&lt;P&gt;e.g for the below table:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="3" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Product&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Location&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;ProdDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;London&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5555&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20250101&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My output should appear to be like:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="3" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Product&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;LastProduced&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;LastProduceDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5555&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20241112&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1234&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;TD align="right"&gt;20250101&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In QV, our table just has&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Product&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LastProduced =&amp;nbsp;&lt;/STRONG&gt;FirstSortedValue(distinct Company,-[Date])&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LastProducedDate =&amp;nbsp;&lt;/STRONG&gt;date(Max (Date),'YYYYMMDD')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when done in a load script, I get a row for "London" and one for "Paris"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas on how I can achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 15:36:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504969#M14558</guid>
      <dc:creator>Oggy172</dc:creator>
      <dc:date>2025-02-07T15:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Returning data based on Max Value</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504978#M14559</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For me the following seems to give the expected output in this example. I only formatted the date a little differently. I used a group by and a preceding load. Would this help you in any way?&lt;/P&gt;
&lt;PRE&gt;T1:&lt;BR /&gt;LOAD&lt;BR /&gt;&lt;SPAN&gt; Product,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; FirstSortedValue(distinct Location, -ProdDate) AS LastProduced,&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;date(Max(ProdDate)) AS LastProducedDate&amp;nbsp;&lt;BR /&gt;group by Product&lt;BR /&gt;;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Product, Location, ProdDate&lt;BR /&gt;1234, London, 12-11-2024&lt;BR /&gt;5555, Paris, 12-11-2024&lt;BR /&gt;1234, Paris, 01-01-2025&lt;BR /&gt;];&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 16:00:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504978#M14559</guid>
      <dc:creator>fldc2500</dc:creator>
      <dc:date>2025-02-07T16:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Returning data based on Max Value</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504981#M14560</link>
      <description>&lt;P&gt;Amazing, thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I actually had pretty much what you had, but left Location in my group by from other testing, and so it created the additional row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks!!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 16:08:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Returning-data-based-on-Max-Value/m-p/2504981#M14560</guid>
      <dc:creator>Oggy172</dc:creator>
      <dc:date>2025-02-07T16:08:59Z</dc:date>
    </item>
  </channel>
</rss>

