Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have employee login date and time from the login date and time i need calculate log out date and time.
In a day employee login first time as some activity and next time he's login in different activity so that i need to calculate between time so that will be logout time for the previous activity
data looks like
| Time | empId | activity | OutPut column I need as |
| 6/16/2020 14:09:17 PM | 245 | APS | 995 seconds |
| 6/16/2020 14:25:17 PM | 245 | KS | 2640 seconds |
| 6/16/2020 15:09:17 PM | 245 | APS | 7200 seconds |
| 6/16/2020 17:09:17 PM | 245 | TG | 0 seconds ( employee last login will consider as 0 seconds |
| 6/14/2020 14:11:17 PM | 999 | APS | 1380 sec |
| 6/14/2020 14:35:17 PM | 999 | KS | 2340 sec |
| 6/14/2020 15:09:17 PM | 999 | KT | 0 seconds ( employee last login will consider as 0 seconds |
| 6/12/2020 14:09:17 PM | 845 | APS | 3600 seconds |
| 6/12/2020 15:09:17 PM | 845 | TG | 0 seconds ( employee last login will consider as 0 seconds |
| 6/11/2020 17:09:17 PM | 777 | KS | 3600 seconds |
| 6/11/2020 18:09:17 PM | 777 | KT | 0 seconds ( employee last login will consider as 0 seconds |
| 6/10/2020 14:09:17 PM | 245 | APS | 995 seconds |
| 6/10/2020 14:25:17 PM | 245 | KS | 2640 seconds |
| 6/10/2020 15:09:17 PM | 245 | APS | 7200 seconds |
| 6/07/2020 14:11:17 PM | 999 | APS | 1380 sec |
| 6/07/2020 14:35:17 PM | 999 | KS | 2340 sec |
| 6/07/2020 15:09:17 PM | 999 | KT | 0 seconds ( employee last login will consider as 0 seconds |
| 6/02/2020 14:09:17 PM | 845 | APS | 3600 seconds |
| 6/02/2020 15:09:17 PM | 845 | TG | 0 seconds ( employee last login will consider as 0 seconds |
| 6/03/2020 17:09:17 PM | 777 | KS | 3600 seconds |
| 6/03/2020 18:09:17 PM | 777 | KT | 0 seconds ( employee last login will consider as 0 seconds |
@Venkateswara_ra , Try a new column like
if( [activity] ="TG",0 , datediff([Time],minx(filter(Table,[empId]=earlier(empId) && [Date] = earlier([Date])),[Time]),second))
[Date] = earlier([Date]) is option for that create a date
date =[time].date
Hi @Venkateswara_ra ,
Have a look at this blog.
To find the vlaue from the previous row and then calculate the time difference.
Regards,
Harsh Nathani
Please see the measures below
Column =
VAR newtime=CALCULATE(MIN(Sheet13[Time]),FILTER(Sheet13,DATEVALUE(Sheet13[Time])=DATEVALUE(EARLIER('Sheet13'[Time]))&&Sheet13[empId]=EARLIER(Sheet13[empId])&&Sheet13[Time]>EARLIER(Sheet13[Time])))
return if(ISBLANK(newtime),0,newtime-Sheet13[Time])*24*60*60However the output is slight different from yours.
14:11-14:35, 24 mins, 1440 seconds, why your output is 1380?
14:35-15:09 34 mins, 2440 seconds, why your output is 2340?
Please let me know if I misunderstand your request.
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |