Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello All,
I have swipe card details table as below
Here i would like to calculate the time duration from In and out each time.
Here in above image we need to get the time duration from 1st I01 to 1st O01 like wise for every In and Out.
But at last I01 theres no Out, so here from that In time to current time calculate the time duration.
How can i calculate the time duration.
Any suggestion please
Mohan V
Solved! Go to Solution.
@Anonymous
Try this
=
VAR OutTime =
CALCULATE (
MIN ( TableName[Time] ),
FILTER (
TableName,
TableName[Time] > EARLIER ( TableName[Time] )
&& TableName[Employee Name] = EARLIER ( TableName[Employee Name] )
&& TableName[In/Out] = "O01"
)
)
VAR Endtime =
IF ( ISBLANK ( OutTime ), NOW (), OutTime )
RETURN
IF ( TableName[In/Out] = "I01", DATEDIFF ( TableName[Time], EndTime, MINUTE ) )
Hi @Anonymous
Try this column
=
VAR OutTime =
CALCULATE (
MIN ( TableName[Time] ),
FILTER (
TableName,
TableName[Time] > EARLIER ( TableName[Time] )
&& TableName[In/Out] = "O01"
)
)
VAR Endtime =
IF ( ISBLANK ( OutTime ), NOW (), OutTime )
RETURN
IF ( TableName[In/Out] = "I01", DATEDIFF ( TableName[Time], EndTime, MINUTE ) )
I have tried what you have suggested.
but it is not giving me the right output
Can you please help me to get this done..
It will help me a lot.
Thank you.
Mohan V
@Anonymous
Try this
=
VAR OutTime =
CALCULATE (
MIN ( TableName[Time] ),
FILTER (
TableName,
TableName[Time] > EARLIER ( TableName[Time] )
&& TableName[Employee Name] = EARLIER ( TableName[Employee Name] )
&& TableName[In/Out] = "O01"
)
)
VAR Endtime =
IF ( ISBLANK ( OutTime ), NOW (), OutTime )
RETURN
IF ( TableName[In/Out] = "I01", DATEDIFF ( TableName[Time], EndTime, MINUTE ) )
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!