Forum Discussion
Coelijoeli
10 years agoAdvocate I
Days between two dates columns
Hello community, I'm building a dashboard with Power BI Desktop. I've connected a SQL server database which has two date fields: [Transactiondate] [Closed] What I want to do is get the ...
HarrisMalik
10 years agoContinued Contributor
gkhare there is a mistake in your formula the third argument to DATEDIFF is Interval not function. Use following formula:
DaysLenght = DATEDIFF(AA_SALES_FACT[CLOSE_DATE],AA_SALES_FACT[START_DATE],DAY)
Edit: I do not know your data model just to be sure the first argument of DATEDIFF() is Start Date, second is End date and third is interval i.e. DAY, MONTH,YEAR etc
DATEDIFF(<start_date>, <end_date>, <interval>)
MAPA
9 years agoRegular Visitor
Hello,
I've used your suggestion which seem to be good but something is wrong there.
Have you ever seen like this:
| Start date | End date | No of days |
| 2016.12.09 | 2017.09.04 | 269 |
| 2016.12.09 | 2017.09.01 | 532 |
| 2016.12.09 | 2017.08.31 | 1855 |
| 2016.12.09 | 2017.08.10 | 244 |
| 2016.12.09 | 2017.07.31 | 1170 |
| 2016.12.09 | 2017.07.13 | 216 |
| 2016.12.09 | 2017.06.30 | 1015 |
When the end date is the last day of the month it gives wrong result. :(
Do you have any idea?