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.
Hi, i am posting this again.
i have a table and i want to calculate time period for a person's current position mean how much time he spent on the specific role. for example Amanda in 2015 was on ED portfolios role till 2019. the duration should be "3 year and 3 months" for ED portfolios position and for ED public services position it should be from 2019 to till 2022 currently, like this for all employee. how to achieve it in DAX.
Data types of columns
Employee Name :- Text
Effective_From :- Date
Current_position & Previous_position:- Text
Solved! Go to Solution.
@HassanAli123 , That will not add up
New column =
var _min = minx(filter(Table, [Employee Name] = earlier([Employee Name]) && [Effective from] > earlier([Effective from])), [Effective from])
var _diff = datediff([Effective from], coalesce(_min, today()), month)
return Quotient(_diff ,12) & " Years " & Mod(_diff ,12) & " Months"
@HassanAli123 ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
want to check why this did not work
New column =
var _min = minx(filter(Table, [Employee Name] = earlier([Employee Name]) && [Effective from] > earlier([Effective from])), [Effective from])
return
datediff([Effective from], coalesce(_min, today()), month)/12.0
Hi @amitchandak
it worked thanks but the output is showing like 8.02 and 2.08. i want this like 8years and 2months in this format
Thanks again if you help me to get this format
@HassanAli123 , That will not add up
New column =
var _min = minx(filter(Table, [Employee Name] = earlier([Employee Name]) && [Effective from] > earlier([Effective from])), [Effective from])
var _diff = datediff([Effective from], coalesce(_min, today()), month)
return Quotient(_diff ,12) & " Years " & Mod(_diff ,12) & " Months"
it is throwing this error.
@HassanAli123 , This is going to be text, You do not have such a date format
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
96 | |
69 | |
45 | |
40 | |
30 |
User | Count |
---|---|
154 | |
94 | |
62 | |
42 | |
41 |