I an trying to do the following while Adding a custom column. col1 and col2 are of date type
if [col1] < #date(2016,7,6) then "Grey"
else if ([col2] > #date(2016,7,6) and [col3] = "Yellow") then "Grey"
I get error saying cannot apply operator < to type Date. How do I compare dates in here?
Go to Solution.
You can change
and it should work 🙂
View solution in original post
When I run "#date(2011,1,1) < #date(2015,1,1)" I get true, so that's not the issue.
What's the exact error message? Are you sure all of the column values are dates?
Are you getting something like this? We cannot apply operator < to types Date and DateTime.
Yes that right. thats exactly the error message I get. how do I resolve this?
The workaround I did was use DAX in power BI desktop instead of M in Edit query. However, I still want the M to work
Check out a full recap of the month!
Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.