Forum Discussion

Si_7777's avatar
Si_7777
Advocate II
10 months ago
Solved

Calc time between users

Hoping someone can help.

 

I am trying to calculate time between actions taken.  

 

For example my table below I have a simple dax expression to calculate the time-taken within the action (Start -End time)

 

But I'd like to calc time between moving to the next action. 

 

For example user 169 first action for the day ends at 8:19 and the next action starts at 8:27 a time diff of 19 minutes.

I'd like to do this for every user within a day.

 

I d like to do this so I can average that time over a day.

 

 

 

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Si_7777 See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
    The basic pattern is:
    Column = 
      VAR __Current = [Value]
      VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

      VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
    RETURN
     ( __Current - __Previous ) * 1.

    • Si_7777's avatar
      Si_7777
      Advocate II

      Thanks for reply cant open that link oddly says Access Denied.

       

      I tried the dax, I need to to work for each user id, the previous date var is bring the previous record but not for that user.  thanks though.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Si_7777 ,

     

    Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to  Greg_Deckler for prompt and helpful response.

     

    If the issue still persists, we kindly request you to share the sample data in a workable format such as text, an Excel file, or a PBIX file with sample data instead of screenshots. Additionally, please include the expected output. This will enable us to assist you more effectively.


    Regards,
    Prasanna Kumar