The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All,
I used the below DAX formula for the tenure calculation in PowerBI. But it gives wrong calculation for the Year.
For example someone who joined in 25 March 2019. Ideally it should be 3 Years and 10 Months. DAX formula gives 04 Years and 10 Months. Can someone help me correcting this formula?
Try
Tenure =
VAR EndingDate =
TODAY ()
VAR Mo =
MOD (
DATEDIFF (
'Active Headcount'[Continuous Service Sysco LABS (Internship/Contract/Permanent)],
EndingDate,
MONTH
),
12
)
VAR Yr =
QUOTIENT (
DATEDIFF (
'Active Headcount'[Continuous Service Sysco LABS (Internship/Contract/Permanent)],
EndingDate,
MONTH
),
12
)
VAR Tenure =
IF (
Yr > 0,
COMBINEVALUES ( " ", Yr, "Years", Mo, "Months" ),
COMBINEVALUES ( " ", Mo, "Months" )
)
RETURN
Tenure
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |