Calculated field for root domain

Hello,
Hoping for help with this please - Looking for calculated field formula to return root domain only. As example, the following strings should all return “example.com

example.com
www.example.com
http://example.com
https://example.com
https://www.example.com
http://example.com/about-us/
https://example.com/

thanks for any help or insight

Hi,
if you use athena as a datasource, there are url functions in Presto, that can extract everything from the url.

If you absolutly need it in a calculated field in Quicksight, I would suggest to start with replace and remove every variation of www and https. Then you start with ‘example’ on every line.

Do you have subdomains? So could there be subdomain.example.com?
If not, you could use split after replace on ‘.’ and take the first value.

With subdomains you probably need an ifelse to see, if there are more than 2 elements after split.