Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FirstSortedValue Function

I have a group of records with an unique Id, and a repetead Ticket_Id, so for one TicketId could be more than one records.

I am trying to load the last value of this group of records order by the unique Id:

The Field1 or Field2 could have a null value, i must load it anyway.

LOAD FirstSortedValue(Ticket_Id, -Id) as Ticket_Id, Field1, Field2

FROM ..\example.qvd (qvd);

This is not working, it's loading the records that don't have null in Field1 or Field2, and with a repetead Ticket_Id. I want to load only the record wich have the last Id of the group, so, the Ticket_Id won't be repeated.

Is this the correct function to do this? It's a problem with the parameters??

2 Replies
Not applicable
Author

LOAD FirstSortedValue(Ticket_Id, -Id) as Ticket_Id, Field1

FROM ..\example.qvd (qvd)

GROUP BY Field1;

this is the correct syntax for the query

Anonymous
Not applicable
Author

LOAD Ticket_Id, FirstSortedValue(Field1, -Id) as Field1

FROM ..\example.qvd (qvd)

GROUP BY Ticket_Id;