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: 
Not applicable

Timestamp in Set

Hi All,

I'm having a problem with an expression and can't get it right.

I'm trying to select the last cost adjustment record for a selected manufacturing order using

sum({$<TransCode = {'CA'}, [Transaction Timestamp] = {"=max(timestamp#([Transaction Timestamp]))"}>} [Average Cost])

Where CA is the transaction code for cost adjustments there can be only one CA for any given transaction timestamp.

In this example there are two cost adjustments:

Cost Adjustments.gif

The following is the result in a chart which is the sum of the Cost After values. I would have thought that the criteria for Max timestamp would have only returned the last of the transaction set which is 11/09/2011 11:52:02 AM and not the sum of both records.

Cost.gif

Hope you can point me in the right direction.

Thanks,

Rich

11 Replies
swuehl
MVP
MVP

Try

=FirstSortedValue({<TransCode = {'CA'}>} [Average Cost],-[Transaction Timestamp])

as expression.

Regards,

Stefan

Not applicable
Author

Thank's for sticking in there with me Stefan.

Rich