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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

How about if you add DISTINCT

FirstSortedValue(DISTINCT RELEASENUMBER, -DATECREATED)

View solution in original post

16 Replies
Anil_Babu_Samineni
MVP
MVP

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
MVP
MVP

you could try with aggr() function

Aggr(max(DATECREATED),DEVICEID)

Anil_Babu_Samineni
MVP
MVP

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
MVP
MVP

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
MVP
MVP

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
MVP
MVP

What exactly your looking for ??