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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ejafarov
Helper I
Helper I

Calculating employee tenure 12 months before

Dears, 

How can I find employee tenure 12 months before from selected date?

The below formula does not work correctly.

 

Tenure for 12 months before =
VAR SelectedDate = MAX(Teqvim[Date])
VAR RelevantPeriodStart = EDATE(SelectedDate, -12)
VAR T1 = CALCULATETABLE(Final, CROSSFILTER(Teqvim[Date], Final[Start Date], NONE))
VAR T2 = FILTER(T1, Final[Start Date] <= SelectedDate && Final[Start Date] >= RelevantPeriodStart)
RETURN
AVERAGEX(
T2,
VAR StartDate = Final[Start Date]
VAR EndDate = COALESCE(Final[Resignation Date], TODAY())
RETURN DATEDIFF(StartDate, MIN(EndDate, SelectedDate), MONTH)
)

Thanks in advance

1 REPLY 1
MohammadLoran25
Solution Sage
Solution Sage

Hi @ejafarov ,

Based on the previous topic we had, If you mean the TenureMeasure for the Same Month of previous year, you can create this measure:

 

CALCULATE (
    [TenureInThePreviousTopic],
    FILTER (
        ALL ( DateTable ),
        DateTable[YearMonthIndex] = MAX ( DateTable[YearMonthIndex] )-12
    )
)

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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