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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
arcall
Frequent Visitor

Total Headcount progression on current year

Hello All,

 

I am trying to achieve a total headcount visual for the following.

 

I have a table with the following columns.

Name of emp, hire date, termination date, Active(y or n), Class (Production or Support/...)

 

The hire date started many years ago.

 

I want to create the following visual that will show the overall headcount by month, but only show the current year up to the current month. Here is what i want to reproduce.

 

headcountmonth.jpg

 

 

 

 

 

 

 

 

Your help is appreciated.

 

Thanks

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @arcall 

Here is a similar post for you refer to:

https://community.powerbi.com/t5/Desktop/Measuring-logged-workdays/m-p/613517#M292418

For your requirement, you just need to do some adjustment:

Step1:

For date table, add a tag for months up today of the current year in the complete date table.

For example:

tag = IF(YEAR('Date'[Date])=YEAR(TODAY())&&MONTH('Date'[Date])<=MONTH(TODAY()),"y","n")

Step2:

When create a crossjoin table, add this conditional "Date "[tag]="y" and Active="y"

Step3:

Then create a Total Headcount measure and then drag date and Class (from new table) in visual

Total Headcount= CALCULATE(COUNTA('Table'[Name of emp]))

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lin,

 

I am not getting the visual I am expecting. 

 

First, I just want to clarify about the date tag. I have a date table with a relationship to the databable (Called "HR Data"). I presume the date tag is under that date table and is a column ? Is the relationship between the date and HR Data will confuse this measure ?

 

Here is the DAX command for tag.

 

tag = IF(YEAR('Date'[Date])=YEAR(TODAY())&&MONTH('Date'[Date])<=MONTH(TODAY()),"y","n")
 

 

In the page date filter, do I select all years ?

 

Here is my crossjoin table :

 

Table = FILTER(CROSSJOIN('Date','HR Data'),'Date'[tag]="y"&&'HR Data'[Active]="Yes"&&'Date'[Date]>='HR Data'[Hire Date]&&'Date'[Date]<='HR Data'[Termination/Release Date])
 
I have a graphic visual with "Shared Axis" with Month from Date table amd Total HeadCount from the following measure.
 
Total Headcount = CALCULATE(COUNTA('HR Data'[Name]))
 
Here is what i've got. 
 
 
 
Graph.jpg
 
I should have a cumulative amount and it should stop at April.
 
What am I doing wrong ?
 
Thanks

 

 

hi, @arcall 

For the date tag, it works well on my side.

There should be something else wrong, could you please share a simple sample pbix file and expected output. for us have a test.

Best Regards,
Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
arcall
Frequent Visitor

I also used this in my measure 

Total Headcount = CALCULATE(COUNTA('table'[Name])). doesn't work.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.