Forum Discussion
MarkShnier__You
Qrew Legend
4 years agoCan you provide an example of result desired?
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
AddieBrunson
4 years agoQrew Member
Sure. Assuming I'd be looking at the data today (3/16/22):
Employee start date is 11/1/21, result would say 4 months.
Employee start date is 7/1/19, result would say 2 years 8 months.
------------------------------
Addie Brunson
------------------------------
Employee start date is 11/1/21, result would say 4 months.
Employee start date is 7/1/19, result would say 2 years 8 months.
------------------------------
Addie Brunson
------------------------------
- MarkShnier__You4 years ago
Qrew Legend
not tested lately but try this. Just change the first line to use your hire date field.
var date MyDate = [Employee Start Date];
var text Years = ToText(Year(Today())-Year($MyDate) -
If( Month(Today())<Month($MyDate)
or
(Month(Today())=Month($MyDate) and Day(Today())<Day($MyDate)),1,0));
var text Months = If(
Month(Today()) > Month($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) >= Day($MyDate), ToText(Month(Today()) - Month($MyDate)),
Month(Today()) = Month($MyDate) and Day(Today()) < Day($MyDate), "11",
ToText(12-(Month($MyDate) - Month(Today()))));
var text DaysDisplay = If ( Day(Today()) > Day($MyDate), ToText( Day(Today()) - Day($MyDate) ),
Day(Today()) = Day($MyDate), "0",
Day(Today()) < Day($MyDate), ToText( Day($MyDate)-Day(Today()) ));
var text RawResult=
$Years & " Year" & If ($Years <> "1","s","") & "<br>" &
$Months & " Month" & If($Months<>"1","s", "") "<br>" &
$DaysDisplay & " Day" & If($DaysDisplay<>"1","s", "");
$RawResult
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------- AddieBrunson4 years agoQrew MemberThank you! Is there an easy way to remove the days calculation from the result? And, is there a way to remove years if an employee has been here for less than a year?--Addie Brunson, Operations AnalystSpotlight | www.spotlightar.com913.375.0574
- MarkShnier__You4 years ago
Qrew Legend
not tested by try this
var text RawResult=
IF($Years >0, $Years & " Year" & If ($Years <> "1","s","") & "<br>")
&
$Months & " Month" & If($Months<>"1","s", "");
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------