DISTANCE

This function will return the distance between two postcode in either miles or kilometers.

Note: the result is the distance 'as the crow flies' and will always round down, e.g. a location 5.1 miles from a reference postcode by car but 2.8 miles as a straight line on a map would return a result of 2.

DISTANCE ( <field_name_1 or postal_code_1>, <field_name_2 or postal_code_2> [, MILES = 0 or KILOMETRES = 1] )
  • field_name_1 or postal_code_1: A numeric field to be used in the calculation of the average.

  • field_name_2 or postal_code_2: A query string represents the records to include in the calculation.

  • Unit of Measurement: 0 for miles or 1 for kilometers

Example: Create a field at the HOUSEHOLD level that returns the distance from the a specified postcode.

DISTANCE ( [HOUSEHOLD.POSTCODE], "BS1 6NP",1 )