March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
Could you please help with the following issue? I have to calculate the average of employee tenure in months for latest role in a table where each individual has multiple rows for role date start.
Name | CompanyStartDate | RoleDateTime | _Months in latest Role | _Employee Tenure |
A | 11/9/2020 0:00 | 12/1/2021 0:00 | 5 | 3-6 Months |
A | 11/9/2020 0:00 | 6/30/2022 0:00 | 5 | 3-6 Months |
A | 11/9/2020 0:00 | 8/15/2022 0:00 | 5 | 3-6 Months |
A | 11/9/2020 0:00 | 11/11/2022 0:00 | 5 | 3-6 Months |
B | 7/5/2021 0:00 | 12/1/2021 0:00 | 7 | 6-12 months |
B | 7/5/2021 0:00 | 9/1/2022 0:00 | 7 | 6-12 months |
B | 7/5/2021 0:00 | 9/12/2022 0:00 | 7 | 6-12 months |
C | 3/1/2021 0:00 | 12/1/2021 0:00 | 9 | 6-12 months |
C | 3/1/2021 0:00 | 7/4/2022 0:00 | 9 | 6-12 months |
D | 12/27/2021 0:00 | 6/14/2022 0:00 | 10 | 6-12 months |
F | 10/4/2021 0:00 | 10/4/2021 0:00 | 13 | 12-24 Months |
F | 10/4/2021 0:00 | 3/1/2022 0:00 | 13 | 12-24 Months |
I calculated the employee's months in role for their latest role start, but how can I calculate the average for the entire table?
_Months in latest Role =
var currDate = CALCULATE(MAX([RoleDateTime]), ALLEXCEPT('Table', 'Table'[Name]))
return ABS ( DATEDIFF ( currDate, TODAY (), MONTH ) )
Solved! Go to Solution.
hi @Chris2016
try to plot a measure like:
Measure =
AVERAGEX(
VALUES(TableName[Name]),
CALCULATE(AVERAGE(TableName[_Months in latest Role]))
)
it worked like:
hi @Chris2016
try to plot a measure like:
Measure =
AVERAGEX(
VALUES(TableName[Name]),
CALCULATE(AVERAGE(TableName[_Months in latest Role]))
)
it worked like:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |