Forum Discussion

CzechCzar's avatar
CzechCzar
New Member
3 years ago
Solved

Question about time since hire

Hello,   I have used these forums extensively in the past to research, and am now hoping you all can help me with PowerQuery.   I have a text field "Time Since Hire". It essentially lists the tim...
  • foodd's avatar
    3 years ago

    In the power query editor create a custom column using the following:

    = Table.AddColumn(#"Added Custom1", "Total Years", each [Years] + [Months]/12 + [Days]/365)

     

     

    let
    Source = Table.FromRows(
    Json.Document(
    Binary.Decompress(
    Binary.FromText("i45WMjRS0lEyBWJDpdhYAA==", BinaryEncoding.Base64),
    Compression.Deflate
    )
    ),
    let
    _t = ((type nullable text) meta [Serialized.Text = true])
    in
    type table [Years = _t, Months = _t, Days = _t]
    ),
    #"Changed Type" = Table.TransformColumnTypes(
    Source,
    {{"Years", Int64.Type}, {"Months", Int64.Type}, {"Days", Int64.Type}}
    ),
    #"Added Custom" = Table.AddColumn(
    #"Changed Type",
    "Total Years",
    each [Years] + [Months] / 12 + [Days] / 365
    )
    in
    #"Added Custom"