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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mgaut341
Helper I
Helper I

Date Difference based on a column filter

I was able to get my date difference custom column, however I need it to take into account the type of service provided if there are multiple chart numbers. 

My current formula is:

 

Wait Times = DATEDIFF('CCHHS Mammo'[Date Referred], 'CCHHS Mammo'[Appointment],MONTH)
 

However, it is providing a date difference for chart number 23549 diagnostic service even though it doesnt have an appt date, since it is taking the appt date from 23549 US Breast service.

mgaut341_0-1753109474357.png

How should I fix my formula to incorporate the service being provided?

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@mgaut341 , Try using

 

Wait Times =
IF('CCHHS Mammo'[Service] = "Diagnostic",
DATEDIFF('CCHHS Mammo'[Date Referred], 'CCHHS Mammo'[Appointment], MONTH),
IF('CCHHS Mammo'[Service] = "US Breast",
DATEDIFF('CCHHS Mammo'[Date Referred], 'CCHHS Mammo'[Appointment], MONTH),
NULL
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
mgaut341
Helper I
Helper I

Thank you! 

bhanu_gautam
Super User
Super User

@mgaut341 , Try using

 

Wait Times =
IF('CCHHS Mammo'[Service] = "Diagnostic",
DATEDIFF('CCHHS Mammo'[Date Referred], 'CCHHS Mammo'[Appointment], MONTH),
IF('CCHHS Mammo'[Service] = "US Breast",
DATEDIFF('CCHHS Mammo'[Date Referred], 'CCHHS Mammo'[Appointment], MONTH),
NULL
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.