Trying to figure out how to calculate the distance between points in Tableau can be a bit tricky. Quick googling doesn't always lead you down the best path, "tableau distance between 2 points" will point you to an old blogpost from 2017. While this might work, Tableau has since added a lot of geospatial formulas to make working with points lines and polygons much easier.

This will take you step by step and show how you can use either a fixed center point, or a parameter to dynamically change the center point location to filter/calculate the points within "x" miles of your chosen location. Keep in mind this is "fly by crow" distance, and will not account for things like bodies of water, traffic or drive time.

This example I'll be finding all Dunkin's within 5 miles of Rhode Island's T.F. Greene Airport.

1) Create Point shape data

To start you will need to convert the lat & long locations to be a point using the makepoint formula.

// name this calculation "points"
makepoint([lat], [long])

2) Creating the center point

A) First option, assuming your using the same point each time you can simply hard code it.

// name this calculation "start_point" 
// fill in with your values
makepoint(-71.4434325 , 42.112425)

B) A bit more complex, this assumes you know a bit about creating parameters. If you want to use your existing points use some unique field like id or address. Create a parameter -> type: string -> allowed: list -> add values from -> your unique field

// name this calculation "start_point"
// obviously make your param with your values first
    { sum(if [store_id] = [selected_store_param] then [Latitude] end) },
    { sum(if [store_id] = [selected_store_param] then [Longitude] end) }

3) Calculate the distance

Next you need to calculate the distance between all of your points from your selected center point.

// name this calculation "distance"
distance([start_point], [points], 'miles')

4) Boolean filter for points

Create a calculation to filter out any points > 5 miles as a boolean

// name this calc "filter_points"
[distance] < 5

5) Count all points

A) count of all points within the filter, this will depend on your data, assuming your using no filters on your data a simple fixed LOD will work.

// name this calc "count_in_distance"
// use -1 if you don't want to include your start point
{ sum(if [filter_points] then 1 else 0 end) - 1 }

B) if your using a lot of filters, first try adding them to context with the previous calc, otherwise you can try using the new "number of records".

// name this calc "count_in_distance"
// use w.e your filename equivalent is the new [number of records]
{ count([your-file-name.csv]) } -1