cancel
Showing results for 
Search instead for 
Did you mean: 
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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors