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! Request now

Reply
mterry
Helper V
Helper V

Trouble comparing dates with todays date

I'm having an issue when trying to create a custom column that needs to compare an action date with todays date. The cause of the issue has been narrowed down to the below, and I'm not sure why what I've pasted doesn't work?

 

if [Action Date] < DateTime.LocalNow() then "something" else "other"

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @mterry,

 

I guess the data type of [Action Date] is date, while DateTime.LocalNow() returns datetime, which leads to unmatched error.

 

Please modify your code as below:

=if [Date] < DateTime.Date(DateTime.LocalNow()) then "something" else "other"

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @mterry,

 

I guess the data type of [Action Date] is date, while DateTime.LocalNow() returns datetime, which leads to unmatched error.

 

Please modify your code as below:

=if [Date] < DateTime.Date(DateTime.LocalNow()) then "something" else "other"

1.PNG

 

Best regards,

Yuliana Gu

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

That worked, thank you

Ashish_Mathur
Super User
Super User

Hi,

 

Your formula works fine for me.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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