'DIVIDE/AVERAGEX in PowerBI
In my data model I have 12 months worth of employee data and month name is in the first column, I.e Jan, Feb Mar etc
I have been using the formula below but I have an issue,
Employee 101 has worked as a sole employee in one department
2 months out of the 12, my formula below will divide that 2/12 equaling =0.16. I want to return average headcount for the department as 1.
So only averaging for months greater 0 employees
DIVIDE(
AVERAGEX(
KEEPFILTERS(VALUES('Date Table'[Month])),
CALCULATE(COUNTROWS(Employee List),Employee List[Emp Status] = "Full Time")),,"")
Solution 1:[1]
So use roundup():
roundup(DIVIDE( AVERAGEX( KEEPFILTERS(VALUES('Date Table'[Month])), CALCULATE(COUNTROWS(Employee List),Employee List[Emp Status] = "Full Time")),,""),0)
But you might consider wrapping it in an if() so it only rounds up when the result is less than 1.
Solution 2:[2]
I was Averagex and Divide at the same time, removing divide fixed the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Solar Mike |
| Solution 2 | UTATOT |
