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
Elisa112
Helper II
Helper II

Find most recent appointments of a certain type

Hi All

 

I am trying find the most recent meetings for a certain type of  appointment. For this KPI I need to find the number of days between each appointment. I have managed to rank appointments for each user but now I am stuck on how to find only certain types of meetings.  Here is a sample of the data 

 

Usermeeting IDmeeting typemeeting daterank
1112Personal01/02/20241
1113Personal03/02/20242
1132Personal04/02/20243
1110Combined31/01/20242
1130Combined30/01/20241
1115Assessment28/01/20241
94Personal15/01/20242
96Personal13/01/20241
922Combined01/02/20241
1864Assessment25/01/20241
1819Personal27/01/20242
1825Personal13/01/20241

 

I am only looking for the 3  most recent meetings of type personal only , so the output should look like this

 

 

User1st Most Recent2nd Most RecentDays diff3rd Most RecentDays diff
1104/02/202403/02/2024101/02/202402/01/1900
913/01/202415/01/20242  

 

thank you in advance

3 REPLIES 3
Elisa112
Helper II
Helper II

Thank you I realise my ranking is incorrect, so your solution did not work, I will keep trying!

Elisa112
Helper II
Helper II

Hi @amitchandak 

 

Thank you, the output I am getting is this

 

Elisa112_0-1707480187254.png

 

I used the bottom measure to find the most recent 3 meetings, which works well for some users and not others, i.e although all users have 3 meeeting or more the measure only pulls 3 in some cases.  Also the date format includes time, and I do not understand why.

Thanks in advance if you have any suggestions to resolve.

amitchandak
Super User
Super User

@Elisa112 , For the third  most recent you can use the index function , and for last date you can use offset to get diff

 

Bottom = CALCULATE(Max('Table'[meeting date]) KEEPFILTERS(INDEX(3, ALLSELECTED('Table'[User], 'Table'[meeting ID], 'Table'[meeting Date]),
ORDERBY([meeting Date], desc),, PARTITIONBY('Table'[User]) )))

 

Last meeting date = CALCULATE(Max('Table'[meeting date]) KEEPFILTERS(offset(-1, ALLSELECTED('Table'[User], 'Table'[meeting ID], 'Table'[meeting Date]),
ORDERBY([meeting Date], ASC),, PARTITIONBY('Table'[User]) )))

 

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

 

Continue to explore Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U

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.