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, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
matty_pants
Frequent Visitor

Modify timestamp across many (20) tables by batch process

I have two dozen tables that I need to merge into one table and the common row value, the Timestamp, has a slight variation in the seconds from table to table. Is there a way to batch change the timestamp to make the seconds null across the tables? The timestamps increase by 30 minutes across all tables otherwise. 

 

The pbix file is found here:  https://filebin.net/4kxvw3rpw0efyd4g/2019-07-10_Roy_Bickell_RCA_Trends.pbix?t=6v8cdunf  (New location that doesn't require Dropbox account).

 

Thanks!

1 ACCEPTED SOLUTION

Hi @matty_pants,

unfortunately, you have to add a step to every table.
Unless you combine all tables into one table at first and then transform the column Timestamp at once. It depends on what your next step is going to be.

 

An example how to use the conversion:

let
    Source = Sql.Databases("10.7.10.186\RCARCHIVE"),
    #"ROY BICKELL SCHOOL" = Source{[Name="ROY BICKELL SCHOOL"]}[Data],
    dbo_1000MTL24 = #"ROY BICKELL SCHOOL"{[Schema="dbo",Item="1000MTL24"]}[Data],
    TimestampWithoutSeconds = Table.TransformColumns(dbo_1000MTL24, {{"Timestamp", each #time(Time.Hour(_), Time.Minute(_), 0)}})in
    TimestampWithoutSeconds

View solution in original post

3 REPLIES 3
Nolock
Resident Rockstar
Resident Rockstar

Hi @matty_pants,

unfortunately, I can't open your sample because only registered users of Dropbox can access the file.

But if I understand you right, you want to remove seconds from a timestamp.

I'd try to create a new timestamp from hours and minutes.

each #time(Time.Hour([Timestamp]), Time.Minute([Timestamp]), 0)

You could also just substract seconds but I don't recommend that because there can also be a subsecond part like 10:20:30,123 which has 123 milliseconds.

Thanks Nolock. How does I implement this? And will it apply to timestamps across many tables at once? (I've updated the link to something outside DB).

Hi @matty_pants,

unfortunately, you have to add a step to every table.
Unless you combine all tables into one table at first and then transform the column Timestamp at once. It depends on what your next step is going to be.

 

An example how to use the conversion:

let
    Source = Sql.Databases("10.7.10.186\RCARCHIVE"),
    #"ROY BICKELL SCHOOL" = Source{[Name="ROY BICKELL SCHOOL"]}[Data],
    dbo_1000MTL24 = #"ROY BICKELL SCHOOL"{[Schema="dbo",Item="1000MTL24"]}[Data],
    TimestampWithoutSeconds = Table.TransformColumns(dbo_1000MTL24, {{"Timestamp", each #time(Time.Hour(_), Time.Minute(_), 0)}})in
    TimestampWithoutSeconds

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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.