cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TahaSolutions
Regular Visitor

Convert date ticks to DateTime

I have seen this formula in another post.

 

Convert(datetime, (MachineGroups.TimeAdded - 599266080000000000)/864000000000)

 

Power BI doesn't have the convert function.

 

Can any one write this command in Power BI DAX language?

2 REPLIES 2
hugoberry
Responsive Resident
Responsive Resident

Try the following conversion

=DateTime.FromFileTime([ticks])-#duration(584388,0,0,0)

 

The FromFileTime counts the ticks from 1600/01/01 so that's why we have the duration of 584388 days to offset this.

Greg_Deckler
Super User
Super User

What type of dateticks do you have in terms of what is the reference date? You should be able to do the conversion using either Power Query "M" code or DAX:

 

https://msdn.microsoft.com/en-us/library/mt296606.aspx

 

https://msdn.microsoft.com/en-us/library/ee634786.aspx

 


@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop! Microsoft Hates Greg's Quick Measures
YouTube Channel! Microsoft Hates Greg
Check out my latest book!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors