I think there as to be a balance between tests and results.
switch(
{@Age} <= 19, “0-19”,
{@Age} in 20 to 34, “20-34”,
{@Age} in 35 to 49, “35-49”,
{@Age} in 50 to 64, “50-64”,
{@Age} >= 65, “65+”,
True, “Unknown”)
Check the image,
there seems to be a problem at the end values of a set.
I made some cosmetic changes to the code
SWITCH(
{@Age} <= 19, "0-19",
{@Age} IN 20 TO 29, "20's",
{@Age} IN 30 TO 39, "30's",
{@Age} IN 40 TO 49, "40's",
{@Age} IN 40 TO 49, "Oldies",
TRUE, "Unknown")
If you copied and pasted your formula and it’s not a typo - take a look at the “Oldies” line. The ages duplicate between it and the next line. That may be causing your problem.
When you need to include data from multiple tables or look at multiple differences, you should look at using a Switch formula. The format for Switch is something like this:
You have condition/result pairs where the condition always evaluates to True or False. The last line should always be a final true with what you want returned if none of the other conditions are met.