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

Chart Expression (Return TestID Where TestDate is Max TestDate)

Data (in a Table Box) looks like this:

PersonIDTestFlagTestIDTestDate
1234B01D410F-4796-450D4/1/2010
12341C9B4F060-A6FF-4D35/5/2011
123437FD7369-075E-4CBC3/16/2011
1234F063F7A6-C055-46054/14/2011
1234AC5396D2-2454-4F924/29/2011
1234096F11C7-CEAB-414C5/11/2011
123416D02D475-56D8-4A1D6/6/2011
1234187BBA227-2036-482B10/17/2011


I'm trying to create a Straight Table that looks like this:

PersonIDTestFlagMOST RECENT TestIDMOST RECENT TestDate
1234187BBA227-2036-482B10/17/2011

In other words, please give me the most recent TestID and TestDate where the TestFlag = 1 (by PersonID).

Currently, I have the Dimension as PersonID, and my Expression looks like this:

MaxString(

{$<
TestDate = {"=$(Max(TestDate))"},
TestFlag = {1}
>}
TestID)
But this is not returning anything...
Please help.
1 Solution

Accepted Solutions
johnw
Champion III
Champion III

most recent test ID   = firstsortedvalue({<TestFlag*={'1'}>} TestID,-TestDate)

most recent test date = max({<TestFlag*={'1'}>} TestDate)

View solution in original post

2 Replies
johnw
Champion III
Champion III

most recent test ID   = firstsortedvalue({<TestFlag*={'1'}>} TestID,-TestDate)

most recent test date = max({<TestFlag*={'1'}>} TestDate)

Not applicable
Author

Wow! Thx so much, John! Seems to be working now