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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have searched the forums for the problem I am having and cannot seem to find the exact problem, so hope you can help!
I am trying to work out the difference between two dates in months, so I can calculate all opportunities due to close this month, and the next two months.
I use this formula:
DateDiff = DATEDIFF(Opportunity[Close Date],TODAY(),MONTH)
However I get the error message " In DATEDIFF function, the start date cannot be greater than the end date", but I expect this - as some oportunities may be closed in the past we wll as the future. How can I solve this so opportunities can be identified in the next 3 months? Even if past opportunities were negative values, for instance.
Any help appreciated - thanks.
Solved! Go to Solution.
@Elder22 so do you want to ignore the opportunity dates that are > than today?
if so its really quite simple, you can ignore it until its relevant
DateDiff =
IF (
TODAY () > Opportunity[Close Date],
DATEDIFF ( Opportunity[Close Date], TODAY (), MONTH ),
0
)
Proud to be a Super User!
@Elder22 so do you want to ignore the opportunity dates that are > than today?
if so its really quite simple, you can ignore it until its relevant
DateDiff =
IF (
TODAY () > Opportunity[Close Date],
DATEDIFF ( Opportunity[Close Date], TODAY (), MONTH ),
0
)
Proud to be a Super User!
Hello,
Thanks for your response - this worked fine for me, thanks very much I will mark as solved.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |