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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Trailing Headcount Calculation

Hello All, 

 

I am trying to create a measure that will allow me to calculate a trailing 30, 90, and 365 day head count and attrition figures. My data is a list of employees by name, ID and their Status (active or Terminated). I also have a date table with a "DayOffset" field. This reads as "0" = today, -1 = yesterday, -30 = 30 days ago and so on...My formula that I am trying for the trailing 30 Headcount calculation is the following but not quite getting it done:

 

"

30 TD HC = COUNTAX(FILTER('Headcount - Trailing', [Status] ="Active" && FILTER('eis Date', [DayOffset]>=-30<=0) ),[Employee Number])"
 
I am getting the error about multiple columns not being able to be converted into a scalar value. Does anyone have any insight? Many thanks in advance!! 
 
Cheers

 

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try

a =
CALCULATE (
    DISTINCTCOUNT ( 'Headcount - Trailing'[Employee Number] ),
    'Headcount - Trailing'[Status] = "Active",
    'eis Date'[DayOffset] >= -30,
    'eis Date'[DayOffset] <= 0
)

This assumes a proper 1-Many relationship between 'eis Date' and the fact table 

If it does not work dp share a sample of the tables involved

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try

a =
CALCULATE (
    DISTINCTCOUNT ( 'Headcount - Trailing'[Employee Number] ),
    'Headcount - Trailing'[Status] = "Active",
    'eis Date'[DayOffset] >= -30,
    'eis Date'[DayOffset] <= 0
)

This assumes a proper 1-Many relationship between 'eis Date' and the fact table 

If it does not work dp share a sample of the tables involved

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Anonymous
Not applicable

Thanks A|B that did the trick! 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.