Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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)

2 Replies

  • Anonymous's avatar
    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)