Forum Discussion
DATEDIFF question
- 10 years ago
That sounds like a feature where Power BI is offering you some Time Intelligence over your datetime column.
It has recognised your "Actual Response Date" column is a date, and it's building a hierarchy on the fly to allow you to drill up and down on visuals that offer visuals (eg, Bar and Column).
There should be a small 'x' to allow you to remove the levels in the hierarchy. It can be a handy feature but you don't always want it.
Not sure about your syntax here, I believe your formula should be:
NoDays = DATEDIFF([Actual Response Date], [Target Response Date], DAY)
Actual Response Date and Target Response Date should be a Date/Time format and NoDays should be Whole Number.
- Cazzagg10 years agoAdvocate I
Thank you so much all of you for responding so promptly. I told you I am very new at this. What you are saying makes sense. I will give both options a try and let you know how I go. Thanks again this is great.
- Phil_Seamark10 years agoMicrosoft Employee
You could create a view over your data in the SQL Database and use that as a source for Power BI
in the view you could use the SQL DateDiff function. Something like:
SELECT
DATEDIFF(DAY,[Actual Response Date],[Target Response Date]) AS NoOfDays,
*
FROM RestOfQueryHere.....- Cazzagg10 years agoAdvocate I
That's a good option too. Thank you
i will let you know how I go. Thanks again for taking the time to answer. Really appreciate it