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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.