Skip to main content

Power BI

New

Date Diff start date not required to preceed end date

Vote (72) 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

470a359b 0289-4905-a3c1-b30e11f3ad15 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

307f7a11 88c4-4e46-a376-acfa04c88a15 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

91e22277 c3e3-4231-9240-685ae017a434 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

f9c8b545 f003-4ee0-a771-ccf1cc8211bd 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

0dfa6d06 e9c2-4b2b-9994-f6cd2ceb6e7c 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

a976b1d9 a473-48a9-be53-351563ec0cc6 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