Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello everyone.
I am trying to calculate the tenure of active employees for 12 months before the selected date. COuld you please help me to correct this dax ?
thanks
the conditions:
If the start date is after the date 12 months before the selected date, we consider it as blank because the employee was not part of the organization for the period we are considering.
If the start date is before or equals the date 12 months before the selected date and the resignation date is blank (which means the employee is still working), then we calculate the date difference between the start date and the date 12 months before the selected date.
If the start date is before or equals the date 12 months before the selected date and the resignation date is also before the date 12 months before the selected date, then we consider it as blank because the employee was not part of the organization for the period we are considering.
If the start date is before or equals the date 12 months before the selected date and the resignation date is after the date 12 months before the selected date, then we calculate the date difference between the start date and the date 12 months before the selected date.
You've defined two variables at the start: SelectedDate which is the maximum date in the Teqvim table and Date12MonthsBefore which is 12 months before the SelectedDate.
The main logic you're trying to implement is to filter the Table1 based on the conditions you've mentioned and then calculate the average tenure of the employees based on the filtered data.
The logic you've written seems mostly correct, but let's address the conditions you've mentioned:
To address the third condition, you can modify the filter condition to:
AND(
Table1[Start Date] <= Date12MonthsBefore,
OR(
ISBLANK(Table1[Resignation date]),
AND(
Table1[Resignation date] > Date12MonthsBefore,
NOT(ISBLANK(Table1[Resignation date]))
)
)
)
This ensures that if the resignation date is before Date12MonthsBefore, those records are not considered.
The rest of your DAX seems fine. You're calculating the average tenure of the employees based on the filtered data and ensuring that the tenure is calculated only for the dates between Date12MonthsBefore and SelectedDate. The CROSSFILTER function at the end ensures that there's no relationship between Teqvim[Date] and Table1[Start Date] while performing the calculations.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |