Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all...
I am trying to find the difference, in days, from today's date and a Report date. If the difference is greater than or equal to 60 days, produce a 1, else a 0. I am receiving a "We cannot apply operator - to types Function and Date" error with the expression below. The data type for Report Date is date, and I'm thinking the error has something to do with trying to compare a date/time field with a date field.
each if Duration.Days(DateTime.LocalNow - [Report Date]) >= 60 then 1 else 0
Kudos to anyone who can assist here.
Solved! Go to Solution.
Please try this instead
each if Duration.TotalDays(Date.From(DateTime.LocalNow()) - [Date]) <=60 then 1 else 0
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this instead
each if Duration.TotalDays(Date.From(DateTime.LocalNow()) - [Date]) <=60 then 1 else 0
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Great. Thank you! Looks like that converts the DateTime format to date at which point it can be compared to my Report Date column.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
10 | |
8 | |
7 |
User | Count |
---|---|
17 | |
13 | |
7 | |
6 | |
6 |