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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.