Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I have two date field as Start_Date and End_Date
ID Start_Date End_Date
101 7/19/2024 9/5/2024
I need to calculate measure with Number of years, Months and days in same column in table object, so that my output should be as below :
ID Start_Date End_Date Total Period
101 7/19/2024 9/5/2024 0 Years 1 Month 18 day
@Tool_Tip The output is a rough approximation because the calculation uses 365 days per year and 30 days per month, which doesn't account for variations in month lengths (28, 29, 30, or 31 days) or leap years. It is calculated from Number days between the two dates.
load *,
Floor((End-Start)/365) & ' Years, ' &
Floor(mod(End-Start,365)/30) & ' Months, ' &
mod(mod(End-Start,365),30) & ' Days' as Period;
LOAD * Inline [
Start, End
20/03/2016, 22/03/2016
21/01/2016, 24/03/2016
20/04/2014, 21/03/2016
20/05/2023, 12/08/2024];
Thank you for your solution but as I mentioned, I want to apply this in table object front end not in back end
@Tool_Tip this logic will work in frond end also. use below chart expression with Start and End Date in dimension
Floor((End-Start)/365) & ' Years, ' &
Floor(mod(End-Start,365)/30) & ' Months, ' &
mod(mod(End-Start,365),30) & ' Days'