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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

We cannot apply operator < to types Date and DateTime error on Power query

I am working on this query that the return  value should be  a date but i keep getting this error  (We cannot apply operator < to types Date and DateTime.)   Does anyone have a suggestion on how i can resolve this error ? Here is my query 
if((DateTime.From([ACT_START_DATE]) <>"" ) and (DateTime.From([ACT_END_DATE]) = "") or
(DateTime.From([START_DATE]) <= Date.AddDays(Date.From(DateTime.LocalNow()),2))) then (DateTime.From([FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1)) else null)

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

try Date.From instead of DateTime.From

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

I tried that and getting this error now Token Then expected. here is how the changes  look like.

 

if((Date.From[ACT_START_DATE]) <>"" ) and ((Date.From([ACT_END_DATE]) = "") or
(Date.From[START_DATE])<= Date.AddDays(Date.From(DateTime.LocalNow()),2))) then ((Date.From[FINISH_DATE]) >= Date.AddDays(Date.From(DateTime.LocalNow()),-1)) else null)

 

 

wdx223_Daniel
Super User
Super User

try Date.From instead of DateTime.From

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.

Top Kudoed Authors