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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Power Query Changing Date Based on Hour Ending Time

I have data and am looking to change the data based upon the hour ending value. So if the date is 1/25/2019 with 12:00:00 AM Hour Ending (24), this should be 1/26/2019 00:00:00. How can transform the data in this way to be able to get this result? All help would be great! Thanks!

 

HourEnding.PNG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You could use this way in edit queries as below:

Step1:

Add a custom column by this formula

if [Hour Ending] = 24 then Date.AddDays([Date], 1) else [Date]

2.JPG

Step2:

Remove "Date" column and rename the new custom column as "Date"

Result:

3.JPG

 

here is sample pbix file, please try it.

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You could use this way in edit queries as below:

Step1:

Add a custom column by this formula

if [Hour Ending] = 24 then Date.AddDays([Date], 1) else [Date]

2.JPG

Step2:

Remove "Date" column and rename the new custom column as "Date"

Result:

3.JPG

 

here is sample pbix file, please try it.

 

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this calculated column:

 

Column = IF(TIME(HOUR('Table (3)'[Date]); MINUTE('Table (3)'[Date]); SECOND('Table (3)'[Date])) = TIME(0;0;0);
'Table (3)'[Date] + 1; 'Table (3)'[Date])
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.