Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
Hello DAX experts 🙂
I'am trying to figure out the formula that calculate an average time spent (in months) in company by previous and active employees (splitted by time periods - months/years). So I got 'start date' column and 'end date' column (for active emloyees remains empty). I did try DATEIFF function but every time it gaves me wrong numbers. Can somebody help me?
Employee | Start date | End date |
A | 2/7/2011 | |
B | 2/14/2011 | 1/4/2016 |
C | 6/1/2011 | |
D | 6/1/2011 | 7/7/2014 |
Solved! Go to Solution.
Typically, I like to add an "Age" column in the query, rather than creating a calculated column with DAX, in the data model. For example, to do an "Age in Days" column...
Or, if you do want to use a calculated column with a DAX formula, this works for me:
Age in Months = DATEDIFF([Start Date], [End Date], MONTH)
Hi @kb,
Have you resolved your issue? You'd better list your expected result according to the sample data. It's difficult to reproduce how to calculate the average time time according to your description.
Best Regards,
Angelia
Hi there,
Here is the image how to do it:
Typically, I like to add an "Age" column in the query, rather than creating a calculated column with DAX, in the data model. For example, to do an "Age in Days" column...
Or, if you do want to use a calculated column with a DAX formula, this works for me:
Age in Months = DATEDIFF([Start Date], [End Date], MONTH)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
147 | |
85 | |
66 | |
52 | |
46 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |