Ask Your Question
3

How can I include the hours component to a DateTime column using PowerQuery?

asked 2021-04-23 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-10-25 02:00:00 +0000

lalupa gravatar image

To include the hours component to a DateTime column using PowerQuery, you can follow these steps:

  1. Select the DateTime column in the Query Editor.

  2. Click on the "Add Column" tab, and select "Custom Column".

  3. In the formula bar, enter the following formula:

DateTime.LocalNow()

This will return the current date and time.

  1. Click on the "OK" button. This will add a new column to your table with the current date and time.

  2. Next, you can merge the two columns (DateTime and the new column) by selecting both, right-clicking and selecting "Merge Columns".

  3. In the "Merge Columns" dialog box, select the separator of your preference (e.g., comma, space, dash).

  4. Click on "OK". This will merge the two columns into one with the date and time in the format you selected.

  5. Finally, you can set the data type of the new column to DateTime by selecting the merged column, clicking on the "Data Type" button, and selecting "DateTime" from the dropdown menu.

Your DateTime column should now include the hours component.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-04-23 11:00:00 +0000

Seen: 13 times

Last updated: Oct 25 '22