0

I have a list of postcodes (UK) in tableau that I use to generate a map of customers. I was trying to calculate the distances of postcodes from some particular places in the UK using the following formula:

3959 * ACOS
(
SIN(RADIANS(Lat)) * SIN(RADIANS(Lat2)) +
COS(RADIANS(Lat)) * COS(RADIANS(Lat2)) *
COS(RADIANS(Lon2) – RADIANS(Long))
)

my problem is: how do I get the longitude and latitude that tableau automatically generates in order to feed the formula above?

(refer to the formula: http://vizpainter.com/mapping-distances-an-alternative-approach/)

GNicoletti
  • 192
  • 2
  • 17

1 Answers1

0

If I understand correctly there is no easy way to dynamically extract the latitude and longitude that Tableau is creating on the fly.

If your data doesn't need to be dynamic then you could use the Worksheet> Export > Data feature to copy out. This will copy the data to an access warehouse and export the latitude and longitude that Tableau has generated.

You can then use this new data source to perform your calculation.

As far as dynamically using the generated lats and longs straight from the original data source. It looks like its a no can do at the moment. You may want to jump on the Tableau community and vote up these ideas as you are not alone!

https://community.tableau.com/ideas/2305 https://community.tableau.com/ideas/2813

smb
  • 653
  • 4
  • 13