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: 
Tyler_Waterfall
Employee
Employee

Expression to return text value (name) of latest log entry

Hej all,

I'm creating a table in Sense in which I want to show Resource  | # Changes | Last Change | Changed By |

Where

Resource = [Resource] field (about 10 unique possible values)

# Changes = sum([change_count])

Last Change = latest date of a change ([change_count]) = Max({<change_count={1}>} LogTimestamp)

Changed By = ActiveUserId of the person who made that latest change*

I can't figure out how to write the expression to get the UserId for the latest change in each [Resource].

Data looks like:

ResourceLogTimestampChange DescriptionActiveUserIdqmc_change
Connection1-14-10 11:34Updated Name and passworddomain\usr31
App1-14-10 10:02Delete Appdomain\usr41
App1-14-10 8:31Rename Appdomain\usr51
Content1-14-10 7:00Added file to contentdomain\usr11
Security Rule1-14-10 5:29changed rule 1803domain\usr31
Security Rule1-14-10 3:58added sync rule 392domain\usr31
Content1-14-10 2:26create content spacedomain\usr91

Seems like this shouldn't be so difficult!

Any ideas?

Some unsuccessful attempts...

maxstring({<ActiveUserId={"=LogTimeStamp=max(LogTimeStamp)"}>} ActiveUserId) >> works when one Resource selected (correct value) but returns NULL when table has multiple rows (Resources)

maxstring({<LogTimeStamp={">=$(max(LogTimeStamp))"}>} ActiveUserId)  >> wrong value

maxstring({<qmc_change={1}, LogTimeStamp={">=$(max(LogTimeStamp))"}>} ActiveUserId) >> wrong value

maxstring({<qmc_change={1}, LogTimeStamp={">=$(max({<qmc_change={1}>} LogTimeStamp))"}>} ActiveUserId)  >> wrong value

only({<qmc_change={1}, LogTimeStamp={">=$(max({<qmc_change={1}>} LogTimeStamp))"}>} ActiveUserId) >> NULL

maxstring({<qmc_change={1}, LogTimeStamp={"=$(max({<qmc_change={1}>} LogTimeStamp))"}>} ActiveUserId) >> NULL

minstring({<qmc_change={1}, LogTimeStamp={"=$(max({<qmc_change={1}>} LogTimeStamp))"}>} ActiveUserId) >> NULL

only({<qmc_change={1}, LogTimeStamp={"=$(max({<qmc_change={1}>} LogTimeStamp))"}>} ActiveUserId) >> NULL

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

Hi, Tyler. Try firstsortedvalue(ActiveUserId,-LogTimeStamp)

Regards,

Vlad

View solution in original post

2 Replies
vgutkovsky
Master II
Master II

Hi, Tyler. Try firstsortedvalue(ActiveUserId,-LogTimeStamp)

Regards,

Vlad

Tyler_Waterfall
Employee
Employee
Author

Vlad - great idea - simple and functional! I don't know how I missed that, so thank you for pointing me to this.

Tyler