Forum Discussion
Fairuz
May 23, 2022Copper Contributor
Power Query: Increase date by one day
Hi,
I am almost done transforming my data in Power Query but I am stuck at this problem. Screenshot:
I am trying to make the dates in the column Date to increase by one day if the time in the column Time.1 is equal to 12:00:00 AM.
Any idea how to do this in the most efficient way? Thanks.
Fairuz
Hi Fairuz
you could add a custom column with this formula:
=if [Time.1]= #time(12,0,0) then Date.AddDays([Date],1) else [Date]
With same logic as Martin_Weiss suggested you may change date in place adding the step
... , NextDate = Table.ReplaceValue( PrevStep , each [Date] , each if [Time] = #time(0,0,0) then Date.AddDays([Date], 1) else [Date] , Replacer.ReplaceValue,{"Date"}) , nextStep = ...
- Martin_WeissBronze Contributor
Hi Fairuz
you could add a custom column with this formula:
=if [Time.1]= #time(12,0,0) then Date.AddDays([Date],1) else [Date]
- FairuzCopper Contributor
Martin_Weiss Thank you! This works fine.