Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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.
Your help is appreciated.
Thanks
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
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.
In the page date filter, do I select all years ?
Here is my crossjoin table :
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
I also used this in my measure
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
140 | |
71 | |
64 | |
52 | |
50 |
User | Count |
---|---|
209 | |
92 | |
62 | |
59 | |
56 |