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
Anonymous
Not applicable

LASTDATE by Record ID

We're trying to find out the last time an Activity was created for each ID in a set of records.

 

Each Lead has an ID and, if contacted, various activities at different times like this:

 

Lead Follow up.PNG

 

 

I've tried the following measure but I get the last date of the year:

 

Lead Follow up = CALCULATE(LASTDATE('Leads Activities'[Activity Created].[Date]),ALLEXCEPT('Leads Activities','Leads Activities'[Lead ID]))

 

Am I missing something from this formula or do I need to use a different measure?   Would it be something to do with that some records don't have an Activity Created date at all?

 

I then wanted to display in a table one row per ID with Name, Record Owner, Activity Type/Date (when last contacted) and Days Since activity based on the Last Follow Up.

 

Would really appreciate any ideas.

 

Many thanks

 

 

1 ACCEPTED SOLUTION
ankitpatira
Community Champion
Community Champion

@Anonymous In power bi desktop go to query editor (Edit Queries), right click your query and duplicate. Then to the duplicated query under Transform tab -> Group by as shown below. Finally Close&Apply and ensure there is active relationship between lead id columns of both the tables. Then use table visual and use leadid,activity from the duplicated columns and other columns from your original query and you will get the desired output.

 

Capture.PNG

View solution in original post

2 REPLIES 2
ankitpatira
Community Champion
Community Champion

@Anonymous In power bi desktop go to query editor (Edit Queries), right click your query and duplicate. Then to the duplicated query under Transform tab -> Group by as shown below. Finally Close&Apply and ensure there is active relationship between lead id columns of both the tables. Then use table visual and use leadid,activity from the duplicated columns and other columns from your original query and you will get the desired output.

 

Capture.PNG

Anonymous
Not applicable

That is awesome.  Thank you so much.

 

 

 

 

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.

Top Solution Authors