How to convert UNIX time to Date in PowerBI for Desktop

11,414

Here's the function:

UnixTimeToDateTime function

let q = (date) => 
let
    Source = (#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, date))
in
    Source
in
    q

When defined, you can use it like this: enter image description here

Share:
11,414
Eugene D. Gubenkov
Author by

Eugene D. Gubenkov

Updated on June 28, 2022

Comments

  • Eugene D. Gubenkov
    Eugene D. Gubenkov about 2 years

    I'm using "Document DB connector" for Power BI as a source of data. Due to limitation (there is not native support for dates) on Document DB we store dates in UNIX format (amount of seconds since 1970) that allows to write date range queries against Document DB.

    The problem is to convert this back to date on Power BI side. I'm looking for possibility of creating Computed column that will convert epoch time to date. Otherwise we will be forced to write to Document DB in both formats that looks redundant.

    epoch time

  • Eugene D. Gubenkov
    Eugene D. Gubenkov over 8 years
    Thanks! Exactly what I was looking for! Can you recommend some resources to mine such information about Power BI from?
  • rocky
    rocky over 8 years
    Here is a summary of resources I've been using when learning PowerBI.
  • Eugene D. Gubenkov
    Eugene D. Gubenkov over 8 years
    Wow! Really appreciate your summarization!