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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi! - I get the following error when trying to perform a calculation in PowerQuery:
Error: We cannot apply operator < to types Number and Date.
Here is my formula:
if [Year] = 2020 and [Sample] = "AAA" and [Date] >= 5/1/2020 and [Occurance] >= 2 then [Sample2] else "Test"
Data Type for [Year] is Whole Number, [Sample] is Text, [Date] is Date and [Occurance] is Whole Number.
Could someone please help with this? Thank you in advance!!
Solved! Go to Solution.
Exactly what you wanted to prove.
Now, make sure that power query knows the date is a date. Use this https://learn.microsoft.com/en-us/powerquery-m/sharpdate
Exactly what you wanted to prove.
Now, make sure that power query knows the date is a date. Use this https://learn.microsoft.com/en-us/powerquery-m/sharpdate
amazing, worked like a charm! thank you!!
Here's how to debug this:-
There looks like there is only one (attempted) date comparison so, as a test, remove everything apart from the date comparison. Still getting the error? There is something wrong with the syntax. PQ thinks one is a date and one is a number, so attempt to fix that.
See if that moves you on a bit.
Gave this a shot but still the same error: "We cannot apply operator < to types Number and Date."
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.