Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

How to calculate two different timestamp ?

Hi all,

 

In the following image i would like to calculate the variance of ExaminationEndTime and ExaminationStartTime.

 

the output must be a integer or a whole number in minutes. so for example :

The variance of these two columns on the first row must be 5.

 

Any suggestions?

 

Many thanks,

 

Rega

 

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    Try to use this calculated column:

     

    Column = ([ExaminationEndTime]-[ExaminationStartTime])*24*60 

     // in minutes

     

    If not works, try to change the columns to Date/Hour, and check which date you have in both columns.

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    Anonymous

    You could try 

    diff mins =
    IF (
        HOUR ( 'Table'[ExaminationEndTime] ) <= HOUR ( 'Table'[ExaminationStartTime] ),
        DATEDIFF (
            'Table'[ExaminationStartTime],
            'Table'[ExaminationEndTime] + 1,
            MINUTE
        ),
        DATEDIFF ( 'Table'[ExaminationEndTime], 'Table'[ExaminationStartTime], MINUTE )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Eric_Zhang,

       

      Thanks for your input but i got the following message:

       

      The start date cannot be greater than the end date...