<?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 only() with aggr in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/only-with-aggr/m-p/1856185#M1215897</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am trying to use the only() function along with aggr() and set analysis, but struggling to get it working.&lt;/P&gt;
&lt;P&gt;I have some factory data along with audit dates and the company name that performed the audit.&lt;/P&gt;
&lt;P&gt;I am trying to get the previous audit company name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached an example QVW with some very basic sample data.&lt;/P&gt;
&lt;P&gt;Basically, the previous audit has the max 'CompletionDate', so its the 'CompanyName' that i want to get thats related to the max(CompletedDate), but its being displayed in a straight table, and the only() function is only returning the result for the max(CompletedDate) for the whole dataset, i need it to work row by row. It does work as expected when selections are made on the FactoryName.&lt;/P&gt;
&lt;P&gt;This is the required output..&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;FactoryName&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;CompanyName&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Factory1&lt;/TD&gt;
&lt;TD&gt;08/06/2018&lt;/TD&gt;
&lt;TD&gt;CompanyA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Factory2&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;27/12/2020&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;CompanyC&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could be that ONLY() is not the correct function to use.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2021 17:18:17 GMT</pubDate>
    <dc:creator>hopkinsc</dc:creator>
    <dc:date>2021-11-05T17:18:17Z</dc:date>
    <item>
      <title>only() with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/only-with-aggr/m-p/1856185#M1215897</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am trying to use the only() function along with aggr() and set analysis, but struggling to get it working.&lt;/P&gt;
&lt;P&gt;I have some factory data along with audit dates and the company name that performed the audit.&lt;/P&gt;
&lt;P&gt;I am trying to get the previous audit company name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached an example QVW with some very basic sample data.&lt;/P&gt;
&lt;P&gt;Basically, the previous audit has the max 'CompletionDate', so its the 'CompanyName' that i want to get thats related to the max(CompletedDate), but its being displayed in a straight table, and the only() function is only returning the result for the max(CompletedDate) for the whole dataset, i need it to work row by row. It does work as expected when selections are made on the FactoryName.&lt;/P&gt;
&lt;P&gt;This is the required output..&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;FactoryName&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;CompanyName&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Factory1&lt;/TD&gt;
&lt;TD&gt;08/06/2018&lt;/TD&gt;
&lt;TD&gt;CompanyA&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Factory2&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;27/12/2020&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;CompanyC&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could be that ONLY() is not the correct function to use.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 17:18:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/only-with-aggr/m-p/1856185#M1215897</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2021-11-05T17:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: only() with aggr</title>
      <link>https://community.qlik.com/t5/QlikView/only-with-aggr/m-p/1856304#M1215911</link>
      <description>&lt;P&gt;If I understand the question,&lt;/P&gt;
&lt;P&gt;try with&amp;nbsp;&amp;nbsp;FirstSortedValue(PreviousCompany, -Date)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxgro_0-1636284696059.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66096iB28C356C9286E6F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxgro_0-1636284696059.png" alt="maxgro_0-1636284696059.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/firstsortedvalue.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/firstsortedvalue.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 11:31:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/only-with-aggr/m-p/1856304#M1215911</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2021-11-07T11:31:03Z</dc:date>
    </item>
  </channel>
</rss>

