Search code examples
powerbipowerquery

How can I convert Column its data type is whole number to data type (Time) in power bi


How can I convert Column its data type is whole number to data type (Time) in power bi

I have TRANSTIME Column in my Table its data type is whole number when I changed the data type to Time all rows in column changed to error.

I decided to create new column and add this formula

Time.FromText(
     if Text.Length([TRANSTIME])=5 then Text.PadStart( [TRANSTIME],6,"0") 
     else [TRANSTIME])

to convert data from TRANSTIME to new column

but it did not work. time wrong and most of rows are error

here example 55656 ==> error 37792 ==> error

I want it 55656 ==> 15:27:36

How can I do it?


Solution

  • Try:

    #time(0, 0, 0) + #duration(0, 0, 0, [TRANSTIME])
    

    It would be super helpful if you mentioned that you want to convert seconds to time.