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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

[Error] Calculate Employee Count per Month

Dear all,

 

I want to determine the number of active employee per month, so I created the following DAX :

Current Employees =
CALCULATE
    (COUNTx
        (FILTER('employee list','employee list'[Join Date]<=max('calendar'[Date]) &&
        (ISBLANK('employee list'[Leaving date]) ||
        'employee list'[Leaving date]>max('Calendar'[Date]))),'employee list'[Personnel No.]),
            CROSSFILTER('employee list'[Join Date],'Calendar'[Date],None))
 
And the result is opposite to my expectation, because it seems it counts employee from previous month

DAX01.PNG
Any idea what's wrong with my DAX?
 
 
Thank you and appreciate your help.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Active employees are calculated from the beginning and you have active employees since 1951. So seem correct to me, Small change needed

Current Employees = 
CALCULATE(COUNTx(FILTER('employee list','employee list'[Join Date]<=max('calendar'[Date]) && not(ISBLANK('employee list'[Join Date])) &&
(ISBLANK('employee list'[Leaving date]) || 
'employee list'[Leaving date]>max('Calendar'[Date]))),'employee list'[Personnel No.]),
CROSSFILTER('employee list'[Join Date],'Calendar'[Date],None))


Hired Employee = 
CALCULATE
    (COUNT('employee list'[Personnel No.]),
    USERELATIONSHIP('employee list'[Join Date],'Calendar'[Date] ), not(ISBLANK('employee list'[Join Date])))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Active employees are calculated from the beginning and you have active employees since 1951. So seem correct to me, Small change needed

Current Employees = 
CALCULATE(COUNTx(FILTER('employee list','employee list'[Join Date]<=max('calendar'[Date]) && not(ISBLANK('employee list'[Join Date])) &&
(ISBLANK('employee list'[Leaving date]) || 
'employee list'[Leaving date]>max('Calendar'[Date]))),'employee list'[Personnel No.]),
CROSSFILTER('employee list'[Join Date],'Calendar'[Date],None))


Hired Employee = 
CALCULATE
    (COUNT('employee list'[Personnel No.]),
    USERELATIONSHIP('employee list'[Join Date],'Calendar'[Date] ), not(ISBLANK('employee list'[Join Date])))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello @amitchandak thanks for the help, it works well

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.