Forum Discussion
Count Dates to get Average
- 4 years ago
Avg Per Employee = AVERAGEX( VALUES('Table'[Employee]), VAR _min_date = CALCULATE(MIN('Table'[Date])) VAR _max_date = CALCULATE(MAX('Table'[Date])) VAR _days = INT(_max_date - _min_date) VAR _items = CALCULATE(COUNTROWS('Table')) RETURN DIVIDE(_items, _days) )
But I'm getting this:This are the days calculated for every employee:
between 09/04 and 13/04 there 4 days not inclusive, but 5 inclusive so if 5 is what you want just add 1 to the VAR _days.
Anyway, in either option I didn't ge tthe numbers you wrote. Even if i took distinct count of the days instead of their diff.
If it should be your numbers, can you share the logic how you need to get to them
For example,
how many days need to be for each employee (only days where he open a ticket or the diff days etc)
Avg Per Employee =
AVERAGEX(
VALUES('Table'[Employee]),
VAR _min_date = CALCULATE(MIN('Table'[Date]))
VAR _max_date = CALCULATE(MAX('Table'[Date]))
VAR _days = INT(_max_date - _min_date)
VAR _items = CALCULATE(COUNTROWS('Table'))
RETURN
DIVIDE(_items, _days)
)
But I'm getting this:
This are the days calculated for every employee:
between 09/04 and 13/04 there 4 days not inclusive, but 5 inclusive so if 5 is what you want just add 1 to the VAR _days.
Anyway, in either option I didn't ge tthe numbers you wrote. Even if i took distinct count of the days instead of their diff.
If it should be your numbers, can you share the logic how you need to get to them
For example,
how many days need to be for each employee (only days where he open a ticket or the diff days etc)