Forum Discussion

Alanoudfahad's avatar
Alanoudfahad
Frequent Visitor
5 years ago
Solved

Calculating time duration

Hi!   I have a data for employees where they check in and check out everytime they enter the building. I want to calculate the time duration per day (I have a date slicer)     For instance...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, Alanoudfahad 

    Please check the below picture and the measure.

     

     

    Result =
    VAR currentid =
    MAX ( Data[ID] )
    VAR currentdate =
    MAX ( Data[Date] )
    VAR minintime =
    CALCULATE (
    MIN ( Data[Time] ),
    FILTER (
    ALL ( Data ),
    Data[ID] = currentid
    && Data[Date] = currentdate
    && Data[In/Out] = "In"
    )
    )
    VAR maxouttime =
    CALCULATE (
    MAX ( Data[Time] ),
    FILTER (
    ALL ( Data ),
    Data[ID] = currentid
    && Data[Date] = currentdate
    && Data[In/Out] = "Out"
    )
    )
    RETURN
    maxouttime - minintime
     

    Hi, My name is Jihwan Kim.


    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM