Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
RichardLee
Creator
Creator

Find the Last Date per ID

I have to Tables 

A User and a Login History.

how do I display the last date per UserID in a table?

Labels (1)
  • Chart

1 Solution

Accepted Solutions
RichardLee
Creator
Creator
Author

I've figured it out, Select the Date as a Measure and set it to Max(LoginDate).

View solution in original post

4 Replies
maxgro
MVP
MVP

If you have the User field (or UserID) in both tables


Users:
load * inline [
User
1
2
3
4
];


Login:
LOAD
ceil(rand()*4) as User,
Date(Floor(makedate(2020) + rand()*365*3)) as LoginDate
AutoGenerate 1000;

 

Make a chart with User as dimension and max(LoginDate) as measure

 

RichardLee
Creator
Creator
Author

yes user field is in both tables this is how I link the two together.

But the login History has the date of every login the user has performed all I want to do is display the Latest Date on a Chart Table per User Row.  

RichardLee
Creator
Creator
Author

I've figured it out, Select the Date as a Measure and set it to Max(LoginDate).

maxgro
MVP
MVP

If I understand, if you want all the rows of the Login table

dimensions User and LoginDate

measure max(TOTAL <User> LoginDate)

maxgro_0-1664278684656.png

 

if you want only the max date for user

dimensions User 

measure max(LoginDate)

maxgro_1-1664278730982.png