Forum

Change a time field...
 
Notifications
Clear all

Change a time field to duration

2 Posts
2 Users
0 Reactions
103 Views
(@tc_owen)
Posts: 3
Active Member
Topic starter
 

I know that you cannot change a "time" field to a duration, but I have yet to figure out how to create a custom column that will do the same.

Attached is a sample csv file with Agent,period,Login Time as the fields. The Login Time is the actual time they were logged in during the period.

1:00:00 equals 1 hour (3600 seconds). 

When I bring the data into Power Query it reads the Login Time as as time formatted field and displays as 1:00:00 AM, 0:51:34 reads as 12:51:34 AM. I've thought of adding a custom column with a time of 12:00:00 AM and subtracting it from the Login Time column. But, I cannot figure how to create this column (call it BaseTime). My final formula would look something like (Login Time - BaseTime) * 86400 (and then change that to a whole number).

So how can I create this BaseTime column or can I simply subtract 12 hours from the Login Time field. If so, please enlighten me on how to do so. Date/Time functions in M are my nemesis right now.

 

Tim

 
Posted : 28/07/2018 5:18 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Tim,

Have you tried changing the Data Type to 'Duration' for the Login Time column? I did that and it returned the time 0.00:51:34 etc. as shown in the csv file.

Mynda

 
Posted : 30/07/2018 5:47 am
Share: