Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

only() with aggr

Hi all,

I am trying to use the only() function along with aggr() and set analysis, but struggling to get it working.

I have some factory data along with audit dates and the company name that performed the audit.

I am trying to get the previous audit company name. 

I have attached an example QVW with some very basic sample data.

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.

This is the required output..

FactoryName Date CompanyName
Factory1 08/06/2018 CompanyA
Factory2 27/12/2020 CompanyC

 

It could be that ONLY() is not the correct function to use. 

Any help would be appreciated. 

1 Reply
maxgro
MVP
MVP

If I understand the question,

try with  FirstSortedValue(PreviousCompany, -Date)

maxgro_0-1636284696059.png

https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/ChartFunctions/Ba...