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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

YTD Monthly Headcount AVG

Hello,

 

I currently am trying to get YTD Monthly Headcount AVG, as well as, Monthly HC Avg for the previous 2 months. However, my monthly HC is calculated by this formula:

"Employee Count =
VAR selectedDate = MAX('Date'[Date])

RETURN

SUMX('employees',
VAR employeeStartDate = [startDate]
VAR employeeEndDate = [termDate]
RETURN IF(employeeStartDate<= selectedDate && OR(employeeEndDate>=selectedDate, employeeEndDate=BLANK() ),1,0)
)"
 
Sorry I don't have any data to share. Please let me know your suggestions ASAP. Thank you!
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Not very clear. But Take YTD of headcount and divide my month year distinct count

 

YTD Sales = divide(CALCULATE([Headcount],DATESYTD('Date'[Date])),CALCULATE(distinctcount('Date'[Month Year]),DATESYTD('Date'[Date])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

Appreciate your Kudos.

Anonymous
Not applicable

Hi @amitchandak,

 

Thank you for your solution! So it's almost what I need. I have attached a photo of my graph currently. The data label numbers are the ending headcount for each month, so I need the average for YTD for each month. So for like August it would add up all of the ending headcounts for the previous months and then divide by 8. Thank you for your help!Capture.JPG

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.