Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Custom column based on time value

Hi, I've not worked with creating a custom formulae where time comparisions are used and was hoping for some pointers.   I have two columns: AppointmentBookedTime: the time a user booked an appo...
  • radpir's avatar
    9 years ago

    hi there,

     

    use this formula for the BookedTimeBusinessHours column:

    = if Time.Hour([AppointmentBookedTime]) >= 9 and Time.Hour([AppointmentBookedTime]) <= 17 

       then "Y"

       else "N"

     

    hope this works for you,

    radpir

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi Anonymous,


    radpir's solution seems well, I convert this to dax, you can refer to it:


    BookedTimeBusinessHours =
    var currentTime=TIME(HOUR([AppointmentBookedTime]),MINUTE([AppointmentBookedTime]),SECOND([AppointmentBookedTime]))
    return
    IF(AND(currentTime>=TIME(9,0,0),currentTime<=TIME(17,0,0)),"Y","N")

    Regards,

    Xiaoxin Sheng