SAP Knowledge Base Article - Public

2707073 - How to calculate Age / Service Period in Days / Months / Years in ORD / Report Canvas

Symptom

This article explains how the Age / Service period based on a specific date can be calculated in Days / Months / Years.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

SAP SuccessFactors Workforce Analytics:

  • Online Report Designer;
  • Report Canvas;

Resolution

  1. Age / Service Period in Days:
    1. Create a new Calculated Column in the report / query.
    2. Use the Token Editor and insert the Dynamic Date Variable 'Today'

      Step2.png
    3. Subtract the desired date value (example: Date of Birth) from %TODAY%.

      Days.png
    4. This field will fetch the Age / Service period in Days.

  2. Age / Service Period in Years:

    The 'Age' for a specific date field can be calculated using the 'Age' function available in ORD calculated columns as well.
    This however will give a rounded down value.

    Create a new calculated column based on the 'Age -Days' calculated column created earlier, and use the following calculation.

    Years.png

    Note: Dividing by 365.25 is an approximation of years, including the extra day in leap years.

  3. Age / service Period in Months.
    Calculating the more precise Years obtained in the previous step, with 12 will fetch the months.

    Months.png


Example of all the three calculations:

Example.png

The Column formatting option can be used as and when required, to control the number of decimal places in the results.

 formatting.png

Keywords

Age, in, Years, Months, Days, Calculate, Service, ORD, Online, Designer, Report, Canvas, Rounding, off, Calculated, Column, Create, Date , KBA , LOD-SF-ANA-ORD , Online Report Designer , How To

Product

SAP SuccessFactors HCM Core all versions ; SAP SuccessFactors Workforce Analytics all versions