cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
benjamin_sasin
Resolver I
Resolver I

Add hours to existing column

Hi, I've got a whole sequence of steps in Power Query and already a bunch of pivot tables connected to the data. I found out that the time input is wrong and believes it's in my current time zone (but it's not). So I have to add + 7 hours. I've done that successfully by adding a column NewColumn = [create_user_date] + #duration(0,7,0,0) , however I would like to replace the current colum instead of adding a new one.

 

I've learned about Table.TranformColumns, but I can't figure out the actual syntax to do this with my current DateTime.

 

Any suggestions?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Super User
Super User

@benjamin_sasin 

 

You can add this step.

Replace text in "red font" with your previous step's name

 

= Table.TransformColumns(#"Changed Type",{"create_user_date", each _ + #duration(0,7,0,0)})

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Super User
Super User

@benjamin_sasin 

 

You can add this step.

Replace text in "red font" with your previous step's name

 

= Table.TransformColumns(#"Changed Type",{"create_user_date", each _ + #duration(0,7,0,0)})

Regards
Zubair

Please try my custom visuals

Okay it's working! Thanks.

 

What's the underscore for in = Table.TransformColumns(#"Source", {"user_create_date", each _ + #duration(0,7,0,0)})?

@benjamin_sasin 

 

_ is the value that is passed as parameter to the function.

In Table.TransformColumns function it is the intersection of current row and Column you have chosen

 

Another example, If you simply create a new custom column as follows...it will return you the current row as records

 

= _

Regards
Zubair

Please try my custom visuals

This is weird syntax, but why not. Thanks!

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!