KNOWLEDGE BASE

Parsing URL Parameters in Tableau Desktop


Published: 26 Oct 2016
Last Modified Date: 13 Jul 2017

Question

How to parse URL parameters in Tableau Desktop.

For example, how to get values for "Category", "Media" or "Programme" in the example URL: /www.example.url/?Category=brand&Channel=paid%20search&Media=Bing&Programme=PG&Region=National

Environment

Tableau Desktop 10

Answer

Use regular expressions in order to capture the value of URL parameters. In Tableau this can be achieved with the built-in formula REGEXP_EXTRACT_NTH, for example: 
REGEXP_EXTRACT_NTH ([URL], '(Category=)(.*?)&', 2) 

This formula will capture the value of the "Media" URL parameter. To capture the value of other parameters please just replace the parameter in the formula, for example for "Media": 
REGEXP_EXTRACT_NTH ([URL], '(Media=)(.*?)&', 2) 

And the following formula will capture the value of the "Programme" URL parameter. 
REGEXP_EXTRACT_NTH ([URL], '(Programme=)(.*?)&', 2) 

 

Additional Information

For more information about Regular expressions, see Additional Functions in Tableau Help. 
Did this article resolve the issue?