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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Atseaukes
Frequent Visitor

Return value based on latest date-time and ID

Hi all,

 

I have the follow example set 'Events Completion':

user_iddatetimesubject_title
14166-8-201809:37:02Session 1 A
14166-8-201809:37:00Session 2 A
2086-8-201809:08:21Exercise 1
10956-8-201808:39:18Session 100
10956-8-201808:39:14Exercise 10
5066-8-201807:57:21Action 2
5066-8-201807:57:17Action 1
8446-8-201805:23:34Step 3
8446-8-201805:23:07Step 2
8445-8-201805:22:46Step 1
8445-8-201805:22:20Step 40

 

From this set I would like to filter on User_ID (unique) and Date-time (latest) and I would see for each filtered item the subject title.

 

So, when I create a visualizing table I would see:

 

user_iddatetimesubject_title
14166-8-201809:37:02Session 1 A
2086-8-201809:08:21Exercise 1
10956-8-201808:39:18Session 100
5066-8-201807:57:21Action 2
8446-8-201805:23:34Step 3

 

I have tried multiple things like LOOKUPVALUE and FIRSTNONBLANK, but I can't figure it out. 

 

I did manage to get only the latest date-time via: 
LastCompletionMoment = CALCULATE(MAX('Events Completion'[DateTime]);FILTER('Events Completion';'Events Completion'[user_id]=EARLIER('Events Completion'[user_id])))

 

Could someone help me out?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Atseaukes

 

Try the following steps:

 

1) Calculate Max Date for each User ID

= CALCULATE(MAX(date), ALLEXCEPT(TableName,TableName[user_id]))

 

2) Use If statement to find subject title

=IF(MAX DATE = DATE,subject_title,NULL)

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@Atseaukes

 

Try the following steps:

 

1) Calculate Max Date for each User ID

= CALCULATE(MAX(date), ALLEXCEPT(TableName,TableName[user_id]))

 

2) Use If statement to find subject title

=IF(MAX DATE = DATE,subject_title,NULL)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.