Skip to main content

Power BI

Needs Votes

Date Diff start date not required to preceed end date

Vote (73) Share
Kevin Adams's profile image

Kevin Adams on 28 Oct 2016 02:15:31

The DATEDIFF function in Power BI DAX, should not require the start date arg to preceed the date given the end date arg. The DATEDIFF function in SQL does not impose this requirement.
This would make implementing the DATEDIFF arg in a date dimension table (with dates going into the future) much easier. Currently the DATEDIFF must be wrapped in an IF statement to work correctly.
Finally, it would seem like this could be fixed by having DATEDIFF in Power BI DAX return a signed, rather than unsigned integer.

Comments (6)
Kevin Adams's profile image Profile Picture

Power BI User on 05 Jul 2020 23:49:11

RE: Date Diff start date not required to preceed end date

It had been working in SASS since Jan 2018 until yesterday (May 2019 I updated my VS 2017).

Kevin Adams's profile image Profile Picture

Power BI User on 05 Jul 2020 23:43:39

RE: Date Diff start date not required to preceed end date

However... I don't think this change was done for SSAS Tabular as DATEDIFF there still returns the same error...?

Kevin Adams's profile image Profile Picture

Power BI User on 05 Jul 2020 23:13:48

RE: Date Diff start date not required to preceed end date

Datediff now returns a negative value so this has been implemented? No notice?!

Kevin Adams's profile image Profile Picture

Foxan Ng on 05 Jul 2020 23:10:39

RE: Date Diff start date not required to preceed end date

Since when has this been rolled out without notice?

Kevin Adams's profile image Profile Picture

Power BI User on 05 Jul 2020 23:09:31

RE: Date Diff start date not required to preceed end date

I would suggest making a new function to ensure existing reports keep working

Kevin Adams's profile image Profile Picture

Power BI User on 05 Jul 2020 23:02:44

RE: Date Diff start date not required to preceed end date

I too have similar situation while working on the Dashboard for Network Scehculde for project Plan;

This make it simpler to write DAX