Calculating distances on the fly between x,y 1 and x,y 2
=ACOS(COS(RADIANS(90-[Lat1])) *COS(RADIANS(90-[Lat2])) +SIN(RADIANS(90-[Lat1])) *SIN(RADIANS(90-[Lat2])) *COS(RADIANS([Long1]-[Long2]))) *6371
Thanks guys for the Geometry lesson.
I'm not actually looking for equations to calculate this distance that part is easy; plus there will need to be a URL action to submit the two addresses to Google Maps anyway. I need the distance between the points mostly as a filter mechanism.
I am looking for tableau calculation techniques and data shaping advice.
For example, if I have a parameter that lets a user select a given site, how do I use values from that site's record in the calculations for all the other sites? That is to say, can I make a parameter (Select an Institution) also cause a number of values from that row to be calculated fields on all other rows?
IF [INSTITUTION] = [Selected Institution] THEN [LATITUDE] end
however this only gives the value for the row that is selected.
I have tried a few different Table Calcs (which I'm admittedly awful at); however, those that I have attempted do not seem to give me consistent results.
Would something like this help conditionally filter the parameter*?
IFNULL([Selcted institution],'Null') = IF [locationparameter] != 'All' THEN [locationparameter] ELSE IFNULL([Selected institution], 'Null') END
*Adding "All" to the parameter? You might need to go STR([Selected instituion])