Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
susheeltyagi
Helper I
Helper I

Need help for converting Unix EPOC time to DateTime convertion in Power BI


Hi

 

I need the expert help. I am trying to convert the EPOC Unix time to Date Time in Power BI (Advance Editor). I am using the below formula for conversion but I don't know where I am wrong the final datetime have wrong.

I have checked with the Epoch & Unix Timestamp Conversion Online Tools (www.epochconverter.com)


ScrubberTime = 649467810 , 669131925, 650023978 (Unix Timestamp need to convert to DateTime)


=========== ScrubberHex2Dec (New Custom Column ) ==========

=Expression.Evaluate("0x" & [ScrubberTime])

============ScrubberTimeUnformatted (New Custom Column )===========

=#datetime(1970,1,1,0,0,0) + #duration(0,0,0,[ScrubberHex2Dec])

 

susheeltyagi_0-1622012687527.png

 

 

Power BI Advance Editor (Screen shot)

 

susheeltyagi_0-1622012165189.png

 

Thanks

 

Susheel

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@susheeltyagi , Try in power query like

#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)

 

 

New column in DAX

New column 
VAR conversion = 'Table1'[unixtime]/(60*60*24)
RETURN 
Date(19701,1,1)+conversion
Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

susheeltyagi
Helper I
Helper I

HI,

 

I have got mine Mistake . My Unix Time dataType was Text. I have converted to WholeNumber and the below query perfectly converted to the DateTime Correctly. 

 

New Column =

#datetime(1970,1,1,0,0,0) + #duration(0,0,0,[ScrubberTime])

 

Thanks for your support.

 

 

View solution in original post

3 REPLIES 3
susheeltyagi
Helper I
Helper I

HI,

 

I have got mine Mistake . My Unix Time dataType was Text. I have converted to WholeNumber and the below query perfectly converted to the DateTime Correctly. 

 

New Column =

#datetime(1970,1,1,0,0,0) + #duration(0,0,0,[ScrubberTime])

 

Thanks for your support.

 

 

amitchandak
Super User
Super User

@susheeltyagi , Try in power query like

#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [UnixTime]/1000)

 

 

New column in DAX

New column 
VAR conversion = 'Table1'[unixtime]/(60*60*24)
RETURN 
Date(19701,1,1)+conversion
Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here


Hi

Thanks for reply. I have tried both the suggestion but in both the case I am getting error.

1.

#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [ScrubberTime]/1000)

Output: error in all the rows.


2. DAX = Date(1970,1,1)+(MeasurementQuery[ScrubberTime]/(60*60*24))
Output :
Getting Error while saving.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.