Forum Discussion

RishikeshD's avatar
RishikeshD
New Member
3 years ago
Solved

How to compare time in DAX ?

I have written following DAX code to compare if vehicle has arrived on time ( set at 12 here) . I have an Inward Table wgich has Inward Time Column of Type Short Time .

 

Vehicle Arrival Window Comformity = COUNTX(inward,(inward[Inward Time]>FORMAT("12:00","Short Time")))

 

But I getting following error :-

 

Error Message:
MdxScript(Model) (14, 69) Calculation error in measure 'employeemaster'[Lifting Distance Comformity]: DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi RishikeshD 

    You can try the following code:

    Vehicle Arrival Window Comformity = COUNTX(inward,TIMEVALUE(inward[Inward Time])>TIMEVALUE("12:00"))

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi RishikeshD 

    You can try the following code:

    Vehicle Arrival Window Comformity = COUNTX(inward,TIMEVALUE(inward[Inward Time])>TIMEVALUE("12:00"))

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.