Skip to content
Home ยป Remove URL Parameters in a Tableau Data Source

Remove URL Parameters in a Tableau Data Source

  • by
  • 2 min read
Tags:

In this blog post, you will learn to remove URL parameters from a column that contains page path URLs. We do this by using the REGEXP_REPLACE function that is available in Tableau.

What are URL Parameters? Url Parameters or query strings are added in the back of we web address. They parameters start with a question mark and are separated by and ampersand (&). Here’s an example from Reddit. This URL leads to a specific story on reddit regarding “town hall” that is trending.

https://www.reddit.com/search?q=town%20hall&source=trending

Query strings are a quick and dirty way to pass parameters from one page to another. It’s mainly used for passing non-sensitive information. Seeing a password in a URL would be a red flag.

If you want to aggregate data by page URL in Tableau and you haven’t excluded it in Google Analytics (for example), you’ll run into troubles. That’s why we would like to go from this…

Tableau url with parameter

…to this.

Tableau url without parameter

We can do that by creating a calculated field and use a formula to strip the URL parameters from a page path. Go to the data source and right click the column header of the column you’d like to edit.

Use the following formula and click apply. Don’t forget to replace the field of your URL column, if it’s not called pagePath.

REGEXP_REPLACE([pagePath],"\?.*=.*","")

Now you’ll have a column that has the same URLs, but without URL parameters. This will allow you to aggregate across base URLs.

Great success!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *