Forum Discussion

andersona1983's avatar
6 years ago
Solved

Checking Time Values

Hello All,   I have attempted to write a few columns, that check a previous time value against a current time value.    I have a power query, that sorts my rows on import from Excel. Theres a con...
  • richbenmintz's avatar
    richbenmintz
    6 years ago

    Hi andersona1983,

     

    Feel like I am a little late to the party, but given your data I think the following will provide the 'Prev' columns you need
    andersona1983 - Ammended to include overlap column and removed formatting as the comparison needs to compare the actual dates and not just the time strings. You can format the columns in another column if required

     

    Prev End Time = 
        var client = [Client Name]
        var index = [Index]
    return
        CALCULATE(MIN('Table'[Appointment End Datetime]), FILTER(ALL('Table'), 'Table'[Client Name] = client && 'Table'[Index] = index -1))
    
    Prev Start Time = 
        var client = [Client Name]
        var index = [Index]
    return
        (CALCULATE(MIN('Table'[Appointment Start Datetime]), FILTER(ALL('Table'), 'Table'[Client Name] = client && 'Table'[Index] = index -1)))
    
    Overlap = 
    if( 'Table'[Appointment Start Datetime]< 'Table'[Prev End Time] || 'Table'[Appointment Start Datetime] = 'Table'[Prev End Time], "Overlap" , "")

     

     

    Hope this Helps,

    Richard


    Did I answer your question? Mark my post as a solution!
    Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!