Can you classify date of birth into age group?

JoeBlackwell 24-01-2017


We have gender & DOB captured in a dimension as 'male:01-01-1980'. Is it possible to create a classification of this using rule builder and a regular expression grouping them into age categories i.e. 19-24, 25-30 etc

Many thanks


Accepted Solutions (1)

Accepted Solutions (1)


In practice, it's possible to classify these values based on age group, however in the long run it's going to be particularly hard to maintain since people age and move from one age group to another. This means you'd have to eventually reclassify every single birthday in a span of several years, which the rule builder wasn't designed to do.

For example, say today someone enters the value "male:01-25-1986". Today they're in the 26-30 bracket, but tomorrow they're in the 31-36 bracket. If someone else shares that same birthday, they're going to be classified under the wrong bracket.

Short term, classifications would work flawlessly. Long term, however, I would recommend passing age groups into a separate variable so they only apply to the specific visitor at hand. Historic reporting would make more sense too, as you'd be able to see which age group they were in at the time, not the age group that they are currently in.

I would also advise against using subclassifications, as each classification value cannot have multiple subclassifications. If you do go through with the classification route, use multiple classifications based on the parent variable.

Answers (2)

Answers (2)


Hi Joe,

Editing my answer, since I went off course with the initial reply. 

I believe it will be easier to use the Sub-classification for this. Rather than creating rules for each year and then have to make this change every year. Use a combination of Rule-builder and importer having the Age Groups as a sub-classification.

use the regex in rule builder to capture the Birth Year in a different classification report. You can use the regex: .*:..-..-(.*)

Once than is done, create a sub-classification of Birth Year as Age Groups and then use importer to classify them easily. This will make it easier to update each year as well.

Here is a Article explaining that scenario as well:

rossw61177531 24-01-2017

Hi Joe, If you use the Classification Rule Builder Tool, you can create a rule for each birth year, say from 1910-2017, and set your respective custom value to 31-36 when your key value is "male:01-01-1980," for example. So instead of using a regular expression for all possible birth years, just create a rule that uses the contains operator and writes the classification as a custom value. Also see: Ross