Forum Discussion

SarahHope's avatar
SarahHope
Helper II
1 year ago
Solved

Simple Workday/OffHours custom column

I am trying to make a custom column that shows either "Workday" or "Off Hours". I have a time type column called "TimeCreated".  It is in AM/PM not 24-hour. My conditions are as follows, but no mat...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi SarahHope, lbendlin, thank you for your prompt reply!  

     

    We can use the Hour function to return the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.):

    Create a calcualted column as shown below:

    DayNight =
    IF(
    HOUR('Table'[TimeCreated]) >= 8 && HOUR('Table'[TimeCreated]) < 17,
    "Workday",
    "Off Hours"
    )

     

    Reference link:

    HOUR function (DAX) - DAX | Microsoft Learn

     

    Best regards,

    Joyce

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.