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
tobiasmcbride
Helper III
Helper III

Number at a particular date

Hi,

 

I have the following data on headcount.

 

NamePositionStart DateEnd DateCurrent Status
Joe BloggsdHead of Marketing21/02/2017 Established
Noah AnyoneHead of Operations21/06/201720/07/2019Left
Joe Bloggs JnrVP Marketing21/07/201820/01/2020Transfer Out

 

I want to be able to calculate the number of employees we had at a particular date.

 

This would ideally be one filter or something that enables me to select a date from and it would give me the total number of employees at that date, that includes those who are currently established, who had just started, who have since left etc. I.e. just a date filter that enables me to say - So at 31st March 2019 how many people did we have in the business, where were they and what were they doing?

 

Easy enough for those established as case of counting them but almost need a time travel ability to look back and say - on X Date we had A established, B had yet to start etc. - and need to include those who have since left but were established employees at that time.

22 REPLIES 22

That won't work as it needs to be able to have a particular date and then say on that date how many did we have in the firm (i.e. whose start date and end date, latter if applicable coincided with it). 

Anonymous
Not applicable

ok in any case add a date dimension and add a slicer on the top with the date


Now you have your date you want to analyze with

CurrentDate=SELECTEDVALUE(YourDateTable[Date])

Now your measure will be

EmployeesAtThatDate=
Var CurrentDate=SELECTEDVALUE(YourDateDim[Date])
RETURN
COUNTROWS(
FILTER(Employees;Employees[StartDate]<=CurrentDate && Employees[EndDate]>=CurrentDate))

As I'm writing on the fly and I don't remember you mihgt have to use

EmployeesAtThatDate=
Var CurrentDate=SELECTEDVALUE(YourDateDim[Date])
RETURN
CALCULATE(COUNTROWS(Employees);FILTER(Employees;Employees[StartDate]<=CurrentDate && Employees[EndDate]>=CurrentDate))



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.