It is measured from wrong place or you have to deduct head thickness.
But in reality you don't need a reporting parameter for that since it is a function of bolt length and thread pitch i.e. Length / Pitch. (as integer). Or you can set the dimension to be rounded to a multiple of pitch and you don't get the rounding up issue that sometimes gives you one more.
After establishing that integer you create an array, you only need one thread line item arrayed towards the right by a distance of pitch with the integer number of repeats.