Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
How to create a column and add 8 hours to the time in Power Query?
4/26/2024 7:19:04 AM --> 4/26/2024 3:19:04 PM
Solved! Go to Solution.
Hi @pang22
You can add a custom column with below code. Use #duration(0,8,0,0) to add 8 hours to a datetime value. #duration - PowerQuery M | Microsoft Learn
[TrackingTime] + #duration(0,8,0,0)
@AnalyticsWizard Thanks for the prompt reply. To my knowledge Power Query doesn't have Date.AddHours function.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @pang22
You can add a custom column with below code. Use #duration(0,8,0,0) to add 8 hours to a datetime value. #duration - PowerQuery M | Microsoft Learn
[TrackingTime] + #duration(0,8,0,0)
@AnalyticsWizard Thanks for the prompt reply. To my knowledge Power Query doesn't have Date.AddHours function.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
In Power Query, you can create a new column that adds 8 hours to a datetime column by using the "Date.AddHours" function. Here’s how you can do it:
1. Click on the column that contains the datetime you want to adjust.
2. Go to the "Add Column" tab in the Power Query editor.
3. Choose "Custom Column" from the menu to open the "Add Custom Column" dialog.
4. In the new column formula area, enter a formula like this:
= Date.AddHours([TrackingTime], 8 )
Replace `[TrackingTime]` with the actual name of your column if it’s different.
5. Give your new column a name, such as "AdjustedTime".
6. Click "OK" to add the new column.
This will create a new column with each datetime value increased by 8 hours. After you’ve done this, remember to apply your changes and load the data back into Power BI if you're working from there.
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly. Appreciate your Kudo 👍
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
105 | |
88 | |
73 | |
66 |
User | Count |
---|---|
124 | |
113 | |
98 | |
81 | |
72 |