Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RAKESH1986
Helper II
Helper II

How to Calculate Time in and Time out Time from Attendance Records

Hi,

 

i have below the record of attendance, could you help me to find time in and time out in separate columns for each user against the given date?

 

RAKESH1986_0-1678779143753.png

 

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddBJCsAgDEDRu7gWNIljdm2PId7/GhXbQIe4k/+IgbRmIHMIxhp04NAjjedmuh1QV5AYcQL+AVQgDnE1ETQoDDQ7Sd+vAWSKKhT2aUISOGTCVw2qrMjvXmTDp497QNVgdK9/dF+jPHo/AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Access_Time = _t, Access_Date = _t, Access_UserID = _t]),
    #"Sorted Rows" = Table.Sort(Source,{{"Access_UserID", Order.Ascending}, {"Access_Date", Order.Ascending}, {"Access_Time", Order.Ascending}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Sorted Rows",{{"Access_Time", type time}, {"Access_Date", type date}, {"Access_UserID", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Access_UserID", "Access_Date"}, {{"In Time", each List.Min([Access_Time]), type nullable time}, {"Out Time", each List.Max([Access_Time]), type nullable time}})
in
    #"Grouped Rows"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.