Forum Discussion
jfoulk
4 years agoFrequent Visitor
Calculate Employee Tenure Over Time
I am trying to calculate active employee tenure at any point in time based on Start Date, Term Date, or Selected Date if not termed. For example, if an associate was active on a selected date, ...
- 4 years ago
Hi jfoulk ,
Please try the following measure:
DateTenure as of Date Chosen = VAR DateChoose = MAX ( Dates[Date] ) RETURN IF ( MAX ( 'Table'[Last Hire Date] ) > DateChoose, "#NUM!", DATEDIFF ( MAX ( 'Table'[Last Hire Date] ), MIN ( COALESCE ( MAX ( 'Table'[Termination Date] ), TODAY () ), DateChoose ), DAY ) / 365 )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-kkf-msft
4 years agoCommunity Support
Hi jfoulk ,
Please try the following measure:
DateTenure as of Date Chosen =
VAR DateChoose =
MAX ( Dates[Date] )
RETURN
IF (
MAX ( 'Table'[Last Hire Date] ) > DateChoose,
"#NUM!",
DATEDIFF (
MAX ( 'Table'[Last Hire Date] ),
MIN ( COALESCE ( MAX ( 'Table'[Termination Date] ), TODAY () ), DateChoose ),
DAY
) / 365
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jfoulk
4 years agoFrequent Visitor
Thank you! This worked!