Question: Is it possible to have a custom distance metric defined to determine the distance between two clusters in Agglomerative clustering in Mathematica?

I have a 3 dimension data with string values along all three dimensions. 

I want to define my own way of measuring the distance between any two clusters (Strings here...)

Also, I want to stop the clustering when the distance between two clusters is greater than a particular threshold value "T". 

Is this available in Mathematica?

Answer: 
The tutorial [tutorial/PartitioningDataIntoClusters](http://reference.wolfram.com/mathematica/tutorial/PartitioningDataIntoClusters.html) has information on Distance functions (also for Strings, e.g. HammingDistance).
Not as a built in function. You will have to write your own. Fortunately it's quite easy and the benefit is you now have a function that provides the custom distance important to your data. 

```
euclidianDistance[{x_List, y_List, 
   z_List}, {xX_List, xY_List, 
  xZ_List}] := Block[{ed, dist, len, lenp},
    len = Length[xX];
    lenp = Length[x];
   If [len != lenp,
      Print["euclidianDistance:Standard and Sample sizes do not match"]];
    ed = Table[((x[[i]] - 
          xXL[[i]])^2 + (y[[i]] - 
          xY[[i]])^2 + (z[[i]] - 
          xZ[[i]])^2)^0.5, {i, 1, len}];
    dist = Chop[ed /. n_ /; n <= 0 -> 0.000000001]
    ]

```

Here's an easy example of Euclidian Distance.