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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CarlBlunck
Resolver I
Resolver I

Trending headcount

Hi all,

 

I've written the following dax expression to calculate a trending headcount but it is consistently giving 1 less than what the result should be.  Example, result for March 2022= 10,245 but running from source, result for March 2022 - 10,246.

 

 

TrendingHeadcount = 
VAR EOM = MAX(dim_PlacementDates[Date])
VAR SOM = MIN(dim_PlacementDates[Date])

RETURN

CALCULATE(DISTINCTCOUNT(fact_PlacementData[WamiKey]),
FILTER(fact_PlacementData,
(fact_PlacementData[HireDate]<= EOM && fact_PlacementData[TerminationDate]>=SOM) || 
(fact_PlacementData[HireDate]<= EOM && fact_PlacementData[TerminationDate]=BLANK())
)
) 

 

 

My underlying data basically looks like this:

WamiKey
HireDate
TerminationDate
101/01/2022 
201/01/202012/03/2022
301/01/202201/05/2022

 

The dim_PlacementDates table the variables are created off is a date table where both the HireDate and TerminationDate columns have inactive relationships with the Date column.

 

Unable to provide the pbix file sorry.  Any insights into why I am consistently getting 1 less than the expected result would be greatly appreciated!!

 

Cheers

Carl

2 REPLIES 2
Anonymous
Not applicable

The measure seems correct to me. Are you sure this isn't happening because of the way the data is imported in Power BI? 

I was wondering that - I noticed that when the data is refreshing it says there are 69,883 rows.  But when I look at the table after the refresh in the data view, it says there are only 25,737 rows, which I find weird...

Table in the data view matches what I am seeing in SQL.

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.