Flux Density Versus Current:
In a straight wire carrying a constant direct current enclosed by air or by free space (a vacuum), the flux density is maximum near the wire and diminishes with rising distance from the wire. You ask, "Is there any formula which expresses flux density as a function of distance from the wire?" The answer is yes. Similar to all other formulas in physics, it is absolutely accurate only under idealized situations.
Consider a wire which is perfectly thin, and also perfectly straight. Assume that it carries a current of I amperes. Assume the flux density (in teslas) is represented by B. Consider a point P at a distance r (in meters) from the wire, as measured all along the shortest possible route (i.e., within a plane perpendicular to thewire). This is demonstrated in figure shown below. The following formula exerts:
B = 2 x 10-7 (I/r)
In the above formula, the value 2 can be considered mathematically precise to any desired number of significant figures. As long as the width of the wire is small compared with the distance r from it, and as long as the wire is logically straight in the vicinity of the point P at which the flux density is measured, this formula is a good indicator of that occurs in real life.
Figure: Flux density differs inversely with the distance from a wire carrying direct current.