Reputation: 41
Average date between two dates in Power BI using DAX not working.
Is there a way to solve this using DAX?
Average days between Registration Date and Start Date (For all user IDs the difference between Start Date minus Registration Date.
Upvotes: 0
Views: 6108
Reputation: 40304
Your title suggests you want to average dates but your comments on Alan's answer suggest that you want an average of durations between dates.
Supposing you have a table Users
with one row per user, you could define the average number of days between registration and start as follows:
AVERAGEX (
Users,
DATEDIFF ( Users[Start Date], Users[End Date], DAY )
)
If you don't have such a table with one user per row, then you have to do a bit of extra work.
Upvotes: 0
Reputation: 81
I would use a measure that takes the difference between the two dates, divides it by 2 and then adds the result to the start date:
This measure returns The average of two dates:
DATEADD(
LASTDATE([Start Date]),
DATEDIFF(
LASTDATE([Start Date]),
LASTDATE([Registration Date]),
DAY
)/2,
DAY
)
EDIT: Changed MAX to LASTDATE.
EDIT2:
This Measure returns the Average difference between the two dates:
AVERAGEX('Table', [Start Date] - [Registration Date])
Upvotes: 1