I was wondering if someone could help me with the following task. I have a data set where each row is one person's answer to a questionnaire. One of the columns contains the year they were born in. In a Dashboard I want to track how many people within different age categories have filled out the survey, I want to do this using a bar chart where I can then use a value guide to show the target for each age group (same target for each group). So I my assumption is I need to use the data expressions option. In that, I have managed to take my data and calculate the age, but despite a lot of Googling, I don't know how to now group the ages into age groups (e.g., 18-30, 31-40, 41-50, 51-60, >60) so I can feed this into the chart. Any help would be much appreciated.
var fs = FeatureSetByPortalItem(
Portal('https://www.arcgis.com/'),
'123456', 0,
['year_of_birth_please_write_full'],
false
);
return GroupBy(
fs,
'OBJECTID', // unique ID field
[
{
name: 'Age_years',
expression: '2025 - year_of_birth_please_write_full',
statistic: 'SUM'
}
]
);