Forum Discussion

Janica123's avatar
Janica123
Icon for Helper I rankHelper I
4 years ago
Solved

Calculate time difference in one column

Hi everyone,    My data looks similar to the first three columns.      Now, what I need to do is to calculate the timedifference of the values in column "Time" for each order and date and ...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    4 years ago

    Hi, Janica123 

     

    Yes, you need to create the datetime measure and use it to create datediff measure to display your results.

    Like this:

    Datetime = SELECTEDVALUE('Table'[Date])+SELECTEDVALUE('Table'[Time])
    Measure = 
    VAR a =
        MAXX (
            FILTER (
                ALLSELECTED ( 'Table' ),
                [Index] < SELECTEDVALUE ( 'Table'[Index] )
                    && [Order] = SELECTEDVALUE ( 'Table'[Order] )
            ),
            [Datetime]
        )
    RETURN
        DATEDIFF ( a, [Datetime], MINUTE )
    

     

     

    Did I answer your question? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.

    Best Regards,
    Community Support Team _ Janey