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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.