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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
AbdulAzizAmod
New Member

Extracting total seconds from timestamps

Good Day all,

 

I need some assistance if possible. 

 

I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp. 

 

I used the following M function with no success:

Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).

 

Please help!

 

Regards,

Abdul

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@AbdulAzizAmod wrote:

Good Day all,

 

I need some assistance if possible. 

 

I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp. 

 

I used the following M function with no success:

Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).

 

Please help!

 

Regards,

Abdul


Try

Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.LocalNow()-#datetime(1970,01,01,0,0,0))),Replacer.ReplaceValue,{"NewColumn.system_time"})

 

and it shall work.

 

Capture.PNGCapture1.PNG

 

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@AbdulAzizAmod wrote:

Good Day all,

 

I need some assistance if possible. 

 

I am currently doing a calculation of time elapsed based between events on time stamps. The system stamps a change in event using the Unix time stamp. I did some table merging and some of the associated values return a null value (this is not the problem). What I want to achieve is to replace those nulls values with the local time so as to substract the local time from the time stamp. 

 

I used the following M function with no success:

Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.FromFileTime)),Replacer.ReplaceValue,{"NewColumn.system_time"}).

 

Please help!

 

Regards,

Abdul


Try

Table.ReplaceValue(#"Expanded NewColumn2",null,Duration.TotalSeconds(Duration.From(DateTime.LocalNow()-#datetime(1970,01,01,0,0,0))),Replacer.ReplaceValue,{"NewColumn.system_time"})

 

and it shall work.

 

Capture.PNGCapture1.PNG

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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