Forum Discussion
Data type is wrong?
- 8 years ago
Nowhere. It was just an example to illustrate the solution.
In your case, go to the Query Editor, select your column with textual dates and adjust the data type using Locale.
The video below illustrates how; it starts already in the Query Editor.
Here is the Query Editor
Days since Last Update = DATEDIFF(TODAY(),'TPA Portfolio'[Last Update Date],DAY)
And I´m getting: In DATEDIFF function, the start date cannot be greater than the end date
I think the Power BI is messing between the date format of my PC (which is English format mm/dd/yyyy) and the format of the data base
- Anonymous8 years agoNot applicable
I dont think that the syntax is the problem. I'm guessing that the problem is on the date formats.
- MarcelBeug8 years ago
Community Champion
In that case you have more than 1 problem.
You can convert text dates to real dates in the Query Editor.
And still you need to provide the earlier date as the first parameter to DATEDIFF.
You may think otherwise, but the syntax is quite clear:
DATEDIFF(<start_date>, <end_date>, <interval>)
You may consider providing more information if you want helpful help.
- MarcelBeug8 years ago
Community Champion
This query TPA Portfolio:
let Source = #table(type table[Last Update Date = text],{{"31/12/2017"}}), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Last Update Date", type date}}, "es-AR") in #"Changed Type"works fine with this custom column:
Days since Last Update = DATEDIFF('TPA Portfolio'[Last Update Date],TODAY(),DAY)Convinced?