Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

First Sorted Value

Hi All,

I have data, say for example the following fields:

Client ID

Date of Purchase (This is a time stamp with also hour, mins and seconds)

Category

Store

Region

A client can have multiple purchases on the same day , i.e. repeated client ID on a date, but I would like extract a list of the customer's last purchase using First Sorted Value. Can someone help me on what the code would look like.

Thanks

H

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Load ClientID,

FirstSortedValue(DateofPurchase ,-DateofPurchase ) As DateofPurchase ,

FirstSortedValue(Category,-DateofPurchase ) As Category,

FirstSortedValue(Store ,-DateofPurchase ) As Store,

FirstSortedValue(Region,-DateofPurchase ) As Region

Group by ClientID;

Load ClientID, Timestamp#(DateofPurchase,'M/D/YYYY hh:mm:ss') As DateofPurchase ,Category,Store ,Region

From Table

View solution in original post

2 Replies
anbu1984
Master III
Master III

Load ClientID,

FirstSortedValue(DateofPurchase ,-DateofPurchase ) As DateofPurchase ,

FirstSortedValue(Category,-DateofPurchase ) As Category,

FirstSortedValue(Store ,-DateofPurchase ) As Store,

FirstSortedValue(Region,-DateofPurchase ) As Region

Group by ClientID;

Load ClientID, Timestamp#(DateofPurchase,'M/D/YYYY hh:mm:ss') As DateofPurchase ,Category,Store ,Region

From Table

Not applicable
Author

Thank you Anbu