Forum Discussion

AI14's avatar
AI14
Icon for Helper III rankHelper III
3 years ago
Solved

compare text to time

Hi   i need to see if my Actual is less than my target but they are in different formats. both are measures however 1 has been formatted into HH:MM so its a text and the other is a normal short tim...
  • tamerj1's avatar
    tamerj1
    3 years ago

    Hi AI14 

    try to use TIMEVALUE function to convert Duration to datetime data type as follows

    Duration =
    VAR _ref =
    MAX ( a[REF] )
    VAR _time1 =
    MAXX ( FILTER ( ALL ( a ), a[REF] = _ref ), [ST] )
    VAR _time2 =
    MINX ( FILTER ( ALL ( a ), a[REF] = _ref ), [ST] )
    RETURN
    TIMEVALUE ( FORMAT ( _time2 - _time1, "hh:mm" ) )