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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors