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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
young351
Frequent Visitor

Custom Column to Replace Date Using "If"

if [TENTATIVE REMOVAL DATE] <= Date.From(DateTime.LocalNow()) then Date.From(DateTime.LocalNow()) +1
else [TENTATIVE REMOVAL DATE])

 

*I want to replace any dates that are prior to today w/ tomorrow's date

 

I am getting this error:

Expression.Error: We cannot apply operator < to types Date and DateTime.
Details:
Operator=<
Left=10/5/2022
Right=9/22/2022 12:00:00 AM

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

Try this 

if [TENTATIVE REMOVAL DATE] <= DateTime.LocalNow() then Date.AddDays(DateTime.LocalNow(),1) else [TENTATIVE REMOVAL DATE]





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
jgeddes
Super User
Super User

Try this 

if [TENTATIVE REMOVAL DATE] <= DateTime.LocalNow() then Date.AddDays(DateTime.LocalNow(),1) else [TENTATIVE REMOVAL DATE]





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

Proud to be a Super User!





That worked!  Thank you so much!

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors