Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi
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"
else [col3]
I get error saying cannot apply operator < to type Date. How do I compare dates in here?
Solved! Go to Solution.
You can change
#date(2016,7,6)
to
#datetime(2016,7,6,0,0,0)
and it should work 🙂
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.
Thanks
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
You can change
#date(2016,7,6)
to
#datetime(2016,7,6,0,0,0)
and it should work 🙂
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |