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

Most Recently Seen Provider

Hello!

 

I am trying to create a calculated column in a customer table that gives me the most recently seen provider from an appointment table. I have been able to make a column that gives me their most recently completed appointment date but for some reason, I can't make giving the corresponding provider work.

 

Any help would be greatly appreciated!

 

Table: Appointment

CustomerIDApptDateProviderStatus
11/1/2020ABCompleted
16/5/2020BCCompleted
112/12/2020DFNot-Confirmed
24/8/2020ABCompleted
36/12/2020DENo-Show
311/15/2020GHNot-Confirmed

 

Table: Customer

CustomerIDDate of Last Completed VisitLast Visit Provider (what I need!)
16/5/2020BC
24/8/2020AB
3  

 

What I am looking for:

A calculated column for Last Visit Provider that looks at the appointment table and for an appointment with a status of "Completed".

 

Ideally, I think a calculated column would be the best thing but if anyone thinks I should make a measure instead, let me know!

1 ACCEPTED SOLUTION

Hi @mattramirez2020 ,

 

Check the formulas

Column = CALCULATE(MAX(Appointment[ApptDate]),FILTER(Appointment,Appointment[CustomerID]=Customer[CustomerID]&&Appointment[Status]="completed"))

Column 2 = CALCULATE(MAX(Appointment[Provider]),FILTER(Appointment,Appointment[CustomerID]=Customer[CustomerID]&&Appointment[ApptDate]=Customer[Column]))

Result would be shown as below.

5.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@mattramirez2020 , Create a new column in Customer table as

maxx(filter(Appointment, Appointment[CustomerID] = Customer[CustomerID]),[ApptDate])

@amitchandak So I have that formula already for Date of Last Visit! I actually need the corresponding Provider for that date!

Hi @mattramirez2020 ,

 

Check the formulas

Column = CALCULATE(MAX(Appointment[ApptDate]),FILTER(Appointment,Appointment[CustomerID]=Customer[CustomerID]&&Appointment[Status]="completed"))

Column 2 = CALCULATE(MAX(Appointment[Provider]),FILTER(Appointment,Appointment[CustomerID]=Customer[CustomerID]&&Appointment[ApptDate]=Customer[Column]))

Result would be shown as below.

5.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.