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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Raman3456
Helper II
Helper II

Calculate HR Attrition Rate ( Without Termination Date)

Hello Everyone ,

 

Hope you are doing well. 

 

I have a data 3 columns (Employee ID, Name , Date) .. I need a DAX formula which is like 

 1) present in Last Month

, 2) Present in Current_Month

 3) Present in next month .

 

Please consider there is no termination date or other dates .

 

Regards,

Ramana PC

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the replies from FreemanZ and Kedar_Pande.

 

Hi @Raman3456 ,

 

Based on your description I created simple data:

vlinhuizhmsft_3-1732502763188.png

 

Then create measures:

 

present in Last Month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-2)+1&&'Table'[Date]<=EOMONTH(TODAY(),-1)))
Present in Current_Month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-1)+1&&'Table'[Date]<=EOMONTH(TODAY(),0)))
Present in next month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),0)+1&&'Table'[Date]<=EOMONTH(TODAY(),1)))
HR Attrition Rate = DIVIDE([Present in Current_Month],[present in Last Month])
Forecast HR Attrition Rate = DIVIDE([Present in next month],[Present in Current_Month])

 

vlinhuizhmsft_0-1732503432955.png

 

You can also use cards to display the names of absent employees, such as:

 

NextLostEmployee = 
VAR _CurrentEmployee=CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-1)+1&&'Table'[Date]<=EOMONTH(TODAY(),0)))
VAR _NextEmployee=CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),0)+1&&'Table'[Date]<=EOMONTH(TODAY(),1)))
VAR _LostEmployee=EXCEPT(_CurrentEmployee,_NextEmployee)
RETURN CONCATENATEX(_LostEmployee,'Table'[Name],"/")

 

vlinhuizhmsft_1-1732502733895.png

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

  

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks for the replies from FreemanZ and Kedar_Pande.

 

Hi @Raman3456 ,

 

Based on your description I created simple data:

vlinhuizhmsft_3-1732502763188.png

 

Then create measures:

 

present in Last Month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-2)+1&&'Table'[Date]<=EOMONTH(TODAY(),-1)))
Present in Current_Month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-1)+1&&'Table'[Date]<=EOMONTH(TODAY(),0)))
Present in next month = CALCULATE(DISTINCTCOUNT('Table'[Employee ID]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),0)+1&&'Table'[Date]<=EOMONTH(TODAY(),1)))
HR Attrition Rate = DIVIDE([Present in Current_Month],[present in Last Month])
Forecast HR Attrition Rate = DIVIDE([Present in next month],[Present in Current_Month])

 

vlinhuizhmsft_0-1732503432955.png

 

You can also use cards to display the names of absent employees, such as:

 

NextLostEmployee = 
VAR _CurrentEmployee=CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),-1)+1&&'Table'[Date]<=EOMONTH(TODAY(),0)))
VAR _NextEmployee=CALCULATETABLE(VALUES('Table'[Name]),FILTER('Table','Table'[Date]>=EOMONTH(TODAY(),0)+1&&'Table'[Date]<=EOMONTH(TODAY(),1)))
VAR _LostEmployee=EXCEPT(_CurrentEmployee,_NextEmployee)
RETURN CONCATENATEX(_LostEmployee,'Table'[Name],"/")

 

vlinhuizhmsft_1-1732502733895.png

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

  

Raman3456
Helper II
Helper II

Here my fields are 

Employee ID , Name , Date 

 

I need the solution like 

 

If any employee which will not be available in next month consider it as attrition .

 

So .... I need a proper dax (to find present, past and next ) based on employee ID .

 

Kedar_Pande
Super User
Super User

@Raman3456 

You can create measures for each condition based on the Date column

Present_LastMonth = 
VAR LastMonthStart = DATE(YEAR(TODAY()), MONTH(TODAY()) - 1, 1)
VAR LastMonthEnd = EOMONTH(LastMonthStart, 0)
RETURN
IF(
CALCULATE(COUNTROWS('Table'), 'Table'[Date] >= LastMonthStart, 'Table'[Date] <= LastMonthEnd) > 0,
1,
0
)
Present_CurrentMonth = 
VAR CurrentMonthStart = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
VAR CurrentMonthEnd = EOMONTH(CurrentMonthStart, 0)
RETURN
IF(
CALCULATE(COUNTROWS('Table'), 'Table'[Date] >= CurrentMonthStart, 'Table'[Date] <= CurrentMonthEnd) > 0,
1,
0
)
Present_NextMonth = 
VAR NextMonthStart = EOMONTH(TODAY(), 0) + 1
VAR NextMonthEnd = EOMONTH(TODAY(), 1)
RETURN
IF(
CALCULATE(COUNTROWS('Table'), 'Table'[Date] >= NextMonthStart, 'Table'[Date] <= NextMonthEnd) > 0,
1,
0
)

You can add these measures to your report to evaluate the presence of employees for the specified time frames.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

FreemanZ
Super User
Super User

Hi @Raman3456 ,

 

try like:

 

PresentThisMonth =
CALCULATE(
    COUNTROWS(data),
    FILTER(
        ALL(Data[date]),
        EOMONTH(Data[date], 0) = EOMONTH(TODAY(), 0)
    )
)
 
PresentLastMonth =
CALCULATE(
    COUNTROWS(data),
    FILTER(
        ALL(Data[date]),
        EOMONTH(Data[date], 0) = EOMONTH(TODAY(), -1)
    )
)
 
PresentNextMonth =
CALCULATE(
    COUNTROWS(data),
    FILTER(
        ALL(Data[date]),
        EOMONTH(Data[date], 0) = EOMONTH(TODAY(), 1)
    )
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.