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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisevans_cj
Contributor III
Contributor III

Value based on MAX Timestamp

Hi,

I'm trying to get the values of a field for the corresponding MAX Timestamp. This will be in straight chart. Below sample data:

DATECREATED DEVICEID RELEASENUMBER
2/9/2017 11:37:12 AM6602062412686771.0.0.6
31/8/2017 4:43:41 PM6602062412686771.0.0.5
31/8/2017 3:07:02 PM6602062412686771.0.0.5
31/8/2017 11:52:06 AM8677205879506601.0.0.5
31/8/2017 11:35:39 AM8677205879506601.0.0.5
31/8/2017 11:25:27 AM8677205879506601.0.0.5
31/8/2017 11:20:34 AM8677205879506601.0.0.5
31/8/2017 10:34:42 AM8677205879506601.0.0.5
31/8/2017 10:06:08 AM6602062412686771.0.0.5
31/8/2017 9:15:36 AM6602062412686771.0.0.5

The Straight Chart should be:

DEVICEID                    MAX(DATECREATED)          RELEASENUMBER

660206241268677           2/9/2017 11:37:12 AM                 1.0.0.6

867720587950660           31/8/2017 11:52:06 AM               1.0.0.5


Any advise?

1 Solution

Accepted Solutions
sunny_talwar

How about if you add DISTINCT

FirstSortedValue(DISTINCT RELEASENUMBER, -DATECREATED)

View solution in original post

16 Replies
Anil_Babu_Samineni

Perhaps these as expressions?

1) Timestamp(Max(DATECREATED))

2) FirstSortedValue(RELEASENUMBER, -DATECREATED)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
chrisevans_cj
Contributor III
Contributor III
Author

I still have a two fields which are causing issues - any idea how to exclude Product and LineItemSales from FirstSortedValue(RELEASENUMBER, -DATECREATED)?

avinashelite

you could try with aggr() function

Aggr(max(DATECREATED),DEVICEID)

Anil_Babu_Samineni

Perhaps this?

FirstSortedValue({$<Product=, LineItemSales=>} RELEASENUMBER, -DATECREATED)

OR

FirstSortedValue({<FieldName -= {'Product', 'LineItemSales'}>} RELEASENUMBER, -DATECREATED)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Exclude Product and LineItemSales? What exactly do you mean?

chrisevans_cj
Contributor III
Contributor III
Author

Not returning what I'm looking for - this give the MAX date - which I've been able to get already

chrisevans_cj
Contributor III
Contributor III
Author

Still getting the same result on the first one and second is not correct

Anil_Babu_Samineni

Then, I am with sunny.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
avinashelite

What exactly your looking for ??