Hello All,
Can someone please help me with this problem?
I'm using MS SQL server. These are the current devrived fields I have created but unsure how to do the rest.
What I'm trying to do is enter a projected date to get years of Service.
I’m trying to create a report that would give me the years, month, days when I subtract it from another field. Here is an example.
HIRE_DT field – PROJ_DATE = PROJ_YRS_SRVC
HIRE_DT field = In PS_EMPLOYEES table
PROJ_DATE = Report Variable (date format)
PROJ_YRS_SRVC = Derived Field with this formula (DATEDIFF(yy,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> )
In the DATEDIFF formula I can change “yy” to either “mm” or “dd” but I want to display all 3 so it will show like this (24 years, 1 months, 21 days)
Is there a way to do this? Thanks for your help.
'('+STR(( DATEDIFF(year,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))
+' Years, ' +STR((DATEDIFF(month,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))
+' Months, ' + STR((DATEDIFF(Day,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))+ ' Days)'
Can someone please help me with this problem?
I'm using MS SQL server. These are the current devrived fields I have created but unsure how to do the rest.
What I'm trying to do is enter a projected date to get years of Service.
I’m trying to create a report that would give me the years, month, days when I subtract it from another field. Here is an example.
HIRE_DT field – PROJ_DATE = PROJ_YRS_SRVC
HIRE_DT field = In PS_EMPLOYEES table
PROJ_DATE = Report Variable (date format)
PROJ_YRS_SRVC = Derived Field with this formula (DATEDIFF(yy,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> )
In the DATEDIFF formula I can change “yy” to either “mm” or “dd” but I want to display all 3 so it will show like this (24 years, 1 months, 21 days)
Is there a way to do this? Thanks for your help.
'('+STR(( DATEDIFF(year,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))
+' Years, ' +STR((DATEDIFF(month,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))
+' Months, ' + STR((DATEDIFF(Day,"PS_EMPLOYEES"."HIRE_DT" ,<<Proj_Date, "{d '"yyyy-mm-dd"'}">> ) ))+ ' Days)'