Skip to main content

I am trying to build custom business regions by grouping users by countries in my application. Specifically, I want to group users into the following categories:

  • If the Country contains "United Kingdom" or "Ireland," then group them as "UKI."
  • If the Country contains "Switzerland," "Germany," or "Austria," then group them as "DACH.
  • etc

I used the following formula with the help of an AI system:

SWITCH(PROPERTY("country", "amplitude_user"), 
"United Kingdom", "UKI",
"Ireland", "UKI",
"Switzerland", "DACH",
"Germany", "DACH",
"Austria", "DACH",
(none))

However, I am encountering an error when trying to save it, indicating that the formula is not valid.

Could someone please assist me in resolving this issue or suggest a corrected version of the formula?

Thank you!

Hello Veronica,

Ben here:

This is what I have done on my own organization,

It look ok on my side:
![](https://amplitude.zendesk.com/attachments/token/Z1kauEDS3iEmQVmxjiQiSG2fR/?name=image.png)


SWITCH(PROPERTY('country', 'amplitude_user'),'United Kingdom', 'UKI','Ireland', 'UKI','Switzerland', 'DACH','Germany', 'DACH','Austria', 'DACH','(none)', 'None')


Best regards,

Ben


P.S. Checkout upcoming events and user meetups on our events page.

Thanks so much ​@BENOIT LIEVIN this works. 


Great to here!

Have a nice week! 🙂


P.S. Checkout upcoming events and user meetups on our events page.