Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm new to PowerBI and PowerQuery so this problem I've run into is really confusing me. What I'm trying to do is get a count of tickets created within the last 14 days and eventually plot the amount of issues per day against a chart. The second formula, a natural progression from my first formula, produces an error message that would make me think the first formula can't be valid, hence the confusion. That said...
Why does the valid formula below accept operators >, <, and =...
= if [CreatedDate] > DateTime.Date(DateTime.LocalNow()) then "1" else "0"
...But the next formula will spit an error if I use greater/less than operators:
if [CreatedDate] > Date.AddDays(DateTime.LocalNow(), -14) then "1" else "0"
The error I get is
"Expression.Error: We cannot apply operator < to types DateTime and Date.
Details:
Operator=<
Left=5/11/2017 5:19:17 PM
Right=10/11/2014"
The error message can't be true since the first formula was accepted and produce the expected results. Any thoughts?
Solved! Go to Solution.
With the second formula, you omitted DateTime.Date. It should be:
if [CreatedDate] > Date.AddDays(DateTime.Date(DateTime.LocalNow()), -14) then "1" else "0"
With the second formula, you omitted DateTime.Date. It should be:
if [CreatedDate] > Date.AddDays(DateTime.Date(DateTime.LocalNow()), -14) then "1" else "0"
Thank you SO much, this was killing me! I mulled over and over the syntax for an embarrassingly long time...
Thanks again!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
85 | |
77 | |
66 |
User | Count |
---|---|
120 | |
112 | |
94 | |
84 | |
75 |