Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Difference between rows and category wise sum

I want to get the difference in time of two rows between out and in and then sum the differences for each category For example: I have the following columns- ECN_ID, Date, Time, In/Out I want to ...
  • ryan_mayu's avatar
    2 years ago

    Anonymous 

    you can create a column

     

    Time difference =
    VAR _last=maxx(FILTER('Table','Table'[ECN_ID]=EARLIER('Table'[ECN_ID])&&'Table'[date]=EARLIER('Table'[date])&&'Table'[Time]<EARLIER('Table'[Time])&&'Table'[In/Out]="Out"),'Table'[Time])
    return if('Table'[In/Out]="In",'Table'[Time]-_last)
     
    then create a measure
    Measure = sum('Table'[Time difference])
     
    pls see the attachment below