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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.