Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ashokr12
Regular Visitor

YTD Average Head count using Averagex and DatesYTD

I  have master list of employees with joining date and relieving date, I have managed to calculate the Head count on any given day

with Measure [HC]=[Op]+[Joiners]-[Attrition]  (Op: Opening Head count on that day), where [Op] [Joiners] and [Attrition] are measures.

 

Once I know the daily head count, I am trying to calculate Average Head count on YTD basis using the  formula

AvgHC=Averagex(Datesytd('Date'(DateKey),[HC])

Screenshot.pngI am checking the result by month and measure is giving correct result for January but for other months it is ignoring the previous months data and calculating Average Head count for only the dates in that month.

 

Tried many types of filters still could not understand why it is happening. been scratching my head since two days.

 

Please help!!

Thanks in Advance

1 ACCEPTED SOLUTION
6 REPLIES 6
Interkoubess
Solution Sage
Solution Sage

Hi @ashokr12,

 

Do you have a calendar table linked to your employee table?

 

Let us know in order to help.

 

Thx.

Hi @Interkoubess!

 

I have a calendar table, but did not link it to the employee table (I read somewhere that that way the table works on any date selected, so did not link it)

 

Thanks!

Hi @ashokr12,

 

You have to link them in order to use time intelligence functions.

I am not sure it will work if not.

 

Let us know if you connect them...

 

Thx. Ninter

Hi @Interkoubess!

 

I referred to this article, which recommends not to link the date table and employee table,

 

https://powerpivotpro.com/2013/04/counting-active-rows-in-a-time-period-guest-post-from-chris-campbe...

 

let me know what you think, Thanks!

Hi @inetguru

 

Followed your soultion and implemented it in my DAX. It is working!

 

Thanks a lot!!

 

Thanks @Interkoubess for taking interest in the problem!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.