Search code examples
databasetimepowerbiformatpowerquery

Weird time formatted data between 1 and 2400


I'm using some open data for a project and the time fields are formatted as integers between 1 and 2400. How do I convert this into normal time?

(I'm using Power Bi for this project)

https://www.kaggle.com/datasets/usdot/flight-delays?resource=download&select=flights.csv


Solution

  • From the comments:

    The columns seem to be in hour and minute format - HHMM . 0007 being 12.07am and 2315 being 11.15pm

    enter image description here

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwMFeK1YlWMjI2NFWKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        #"Added Custom" = Table.AddColumn(Source, "Custom", each Time.FromText([Column1],[Format = "HHmm", Culture = "en-GB"]), type time)
    in
        #"Added Custom"