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

Getting Head Count as on a particular date

I have a table as below. I am tryingt to get the headcount as on a particular date. For example, as on 12-Nov-2016, 5 people have joined and 2 have left, so the headcount stands at 3.

 

I have created two measures as below. But here I can only calculate as on today. Is there a way to pass a parameter instead of today? Or a different way of calculating?

 

Total Joiners = CALCULATE( COUNTA(HCRaw[Name]), DATESBETWEEN(HCRaw[JD].[Date], DATE(2016,1,1), Today()))

Total Leavers = CALCULATE( COUNTA(HCRaw[Name]), DATESBETWEEN(HCRaw[LD].[Date], DATE(2016,1,1), Today()))

 

+------+--------------+--------------+
| Name | JD                  | LD                 |
+------+--------------+--------------+
| ALSK  | 01-Aug-2016 | 12-Nov-2016 |
| IKL     | 09-Oct-2016  |                       |
| ASK   | 09-Oct-2016  |                       |
| ASL   | 10-Oct-2016  |                       |
| KOL   | 12-Nov-2016 |                       |
| IKL     | 15-Dec-2016 | 20-Jan-2017 |
| ABC   | 21-Dec-2016 | 24-Jan-2017 |
| DEF   | 20-Jan-2017  |                       |
| GHI   | 24-Jan-2017  | 10-Oct-2016 |
+------+--------------+--------------+

 

-Shashanka

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

Currently, query parameter can't be passed to the measure. In your scenario, to calculate joined / leave employees per day, you can create a calendar table like below:

 

Calendar = CALENDAR(MIN('HCRaw'[JD]),MAX('HCRaw'[LD]))

 

Then create three measures in the HCRaw table:

 

JoinedPerDay = CALCULATE(COUNTA(HCRaw[Name]),FILTER(ALL(HCRaw),'HCRaw'[JD]=MAX('Calendar'[Date])))

LeavePerDay = CALCULATE(COUNTA(HCRaw[Name]),FILTER(ALL(HCRaw),'HCRaw'[LD]=MAX('Calendar'[Date])))

Headcount = 'HCRaw'[JoinedPerDay]-'HCRaw'[LeavePerDay]

 

Please see attached .pbix file.

 

Best Regards,
Qiuyun Yu

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

Thanks @v-qiuyu-msft

 

I am looking for a different solution that what you've calculated. I do not want to know the HC for a particular day, I want to HC as on a particualr day. So it should consider overall HC.

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.