Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am attempting to calculate a YTD average of how many employees we have for a given day or month. For example and if we had 1,000 employees in Jan and 1,200 in Feb, the Feb YTD average would be 1,100. I found the below DAX (modified from this blog) to be useful in calculating the number of employess on a given day but am now struggling with measuring a YTD average for a given day. Any help is appreciated.
Thanks
Employee Count =
SUMX (
GENERATE (
CALCULATETABLE (
SUMMARIZE (
EmployeeRosterHires,
EmployeeRosterHires[Hire Date],
EmployeeRosterHires[Termination Date],
"Rows", COUNTROWS ( EmployeeRosterHires )
),
ALL ( 'Date' )
),
INTERSECT (
DATESBETWEEN ( 'Date'[Date], EmployeeRosterHires[Hire Date], EmployeeRosterHires[Termination Date] ),
LASTDATE ( 'Date'[Date] )
)
),
[Rows]
)
Solved! Go to Solution.
Substituting AVERAGEX for SUMX in the Employee Count formula rendered that for every employee, there was one employee on average. There's a meme there somewhere, for sure.
However and being that this was my first post, I accidentally posted it twice under two differents subject tags. The response I received from the other post proved correct and is as follows:
AVG Daily = AVERAGEX(ALLSELECTED('Calendar'),[Employee Count])
Thanks for your help
Hi @tango1201,
Have you try to use averagex to replace the sumx function?
Employee average Count = AVERAGEX( GENERATE ( CALCULATETABLE ( SUMMARIZE ( EmployeeRosterHires, EmployeeRosterHires[Hire Date], EmployeeRosterHires[Termination Date], "Rows", COUNTROWS ( EmployeeRosterHires ) ), ALL ( 'Date' ) ), INTERSECT ( DATESBETWEEN ( 'Date'[Date], EmployeeRosterHires[Hire Date], EmployeeRosterHires[Termination Date] ), LASTDATE ( 'Date'[Date] ) ) ), [Rows] )
Regards,
Xiaoxin Sheng
Substituting AVERAGEX for SUMX in the Employee Count formula rendered that for every employee, there was one employee on average. There's a meme there somewhere, for sure.
However and being that this was my first post, I accidentally posted it twice under two differents subject tags. The response I received from the other post proved correct and is as follows:
AVG Daily = AVERAGEX(ALLSELECTED('Calendar'),[Employee Count])
Thanks for your help
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
58 | |
36 | |
32 |
User | Count |
---|---|
90 | |
62 | |
61 | |
49 | |
45 |