×
Contact Us

Data

# Going the Distance in Tableau: Greater Interactivity with Parameters

//

In this series, we will explore different types of calculations involving calculating distance. From a simple iteration to geographic clustering, we will take your data as far as it can go with Tableau.

In the last blog, we looked at comparing all locations against a single, static point.

Now, we can build on this and account for a selection of points in our distance calculation by using a parameter. This will enhance the interactivity of our viz and allow selection of a comparison city from a list of cities:

Here, I use a string parameter to list out my five distribution centers; if you need a performance boost, try using an integer parameter and setting the Display As to your city names. Then I create two calculated fields, both tied to the one parameter, separately referencing the latitude and longitude of the five parameter members. I then include these two calculated fields in my distance calculation:

And if you want to copypasta:

```3959 * ACOS

(

SIN(RADIANS([lat])) * SIN(RADIANS([lat parameter calc])) +

COS(RADIANS([lat])) * COS(RADIANS(35.4720)) *

COS(RADIANS([long parameter calc]) - RADIANS([long]))

)```

3959 is half of the Earth’s diameter in miles. If you are using kilometers, this needs to be 6371 km.

The next post in this series will take this a step further and focus on going completely dynamic with table calculations.

### The Latest

• ##### Intern Dashboards: The Rise and Fall of India’s EdTech Market
Easily move to Tableau Cloud with our Tableau Cloud Migration checklist.

### KeepWatch by InterWorks

Whether you need support for one platform or many, our technical experts have you covered.

## Grant Eisenmenger

Analytics Consultant
Options for Row-Level Security in Tableau Now that you know you need Row-Level Security (RLS) and you are familiar with the basic concepts and building blocks, we can take a ...
Row-Level Security Basics in Tableau In this blog, we will run through fundamental concepts and building blocks for Row-Level Security (RLS) solutions. This will include: ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!