Follow the steps listed below to learn how to use custom expressions to categorize a participant's current age and age at intake into different groups and display them in a native report.
Step 1: Add the Date of Birth column
In your report section, pull in your participant Date of Birth column and their intake date column.
Then, in the column properties, change the data style to 'Age' and select Apply.
Step 2: Add a Number Calc column
Next, pull in a Number Calc column under Special Columns in the Field Choices palette.
In the Number Calc column properties, select the Date of Birth column in the first Calculation Columns dropdown field. Then, select the Custom Numeric data style and type the below custom expression into the box. You can customize the number ranges and the text in quotes to your organization's needs.
IF([column] between 1 and 18, "under 18", IF([column] between 18 and 65, "18 to 65", IF([column] >65, "Over 65", null)))
Step 3 (optional): Add columns for intake age
To see what age group participants fell in at the time of intake, you can add the following columns to a report section:
Date of Birth
Intake Date
Date/Time Calc
Number Calc
In the Date/Time Calc column properties, set the Calculation Type to 'Days Between' and select the Date of Birth and Intake Date columns in the Calculation Columns dropdown fields (the Date of Birth field must be displayed as a date, not an age). Select Apply.
Then, in the Number Calc properties, set the Calculation Type to 'Divide'. Select the Date/Time Calc column in the first dropdown field and add a static value of '365' in the second field.
Select the Custom Numeric data style and enter the following custom expression as applicable to your organization:
IF([column] between 1 and 18, "under 18", IF([column] between 18 and 65, "18 to 65", IF([column] >65, "Over 65", null)))