Forum Discussion

mgaut341's avatar
mgaut341
Helper II
1 year ago
Solved

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.

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

  • 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
    )
    )

2 Replies

  • 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
    )
    )