Forum Discussion

icturion's avatar
icturion
Resolver II
7 years ago
Solved

Calculate difference between two date/time values

Hi,

 

I have two columns with time stamps. 

first i create a measure for echa column thats calculates the average time:

Measure = FORMAT(AVERAGE(AQZ_TRAVEL_MON[Tijd_Begin]);"HH:MM: SS")
 
Now i want to calculate the time differents between the to measures. can some one help me with that?
 
Kind regards
Icturion
  • Anonymous's avatar
    Anonymous
    7 years ago

    Try this:

    measure differents = FORMAT('Table'[measure 1] - Table[measure 2];"HH:MM: SS")

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    icturion - Your measures are formatting as text. Remove the formatting, do the calculation, and apply the formatting after that.

    Hope this helps,

    Nathan

    • icturion's avatar
      icturion
      Resolver II

      Hoi Anonymous 

       

      measure 1 = AVERAGE(Column_x[start_time])

      measure 2 = AVERAGE(Column_y[stop_time])

       

      measure differents = FORMAT(SUMX('Table';'Table'[measure 1]- (Table[measure 2])));"HH:MM: SS")

       

      The last measure generates a systax error. if i remove the format option the systax error is gone. 

       

      But the result in the right column is not correct. differents between record one and two can not be so different (see picture)

       

       

      Kind regards,

      ICturion

      • Anonymous's avatar
        Anonymous
        Not applicable

        Why are you using SUMX to find the difference?