Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get entry for max date per user

Hi community,

I have a data base with a table of users (idvisit) and a table with users' actions (event_action) and a time stamp (server_time).

My approach seems to retrieve the latest data base entry, but I'd like to get the latest entry per user (idvisit).

How can I retrieve the latest action per user in a bar chart?

dimension:

event_action

measure:

count({$<server_time={"$(=max(server_time))"}>}idvisit)

Thanks!

Labels (1)
2 Replies
sunny_talwar

May be this

Sum(Aggr(If(server_time = Max(TOTAL <idvisit> server_time), 1, 0), idvisit, event_action, server_time))

Not applicable
Author

Hi Sunny,

this query seems to result in the same as as simple "count(idvisit)" as a measure.

I think the problem is that my users trigger multiple events but I am only interested in the very last event:

User Table

UserA

...


Action Table

event_action1    UserA    2017-11-01 14:00

event_action2    UserA    2017-11-01 15:00

event_action1    UserA    2017-11-01 15:30

event_action3    UserA    2017-11-01 16:00

...


The result I want is only: UserA = event_action3 at 2017-11-01 16:00