The upstreamness is calculated as follows, where, A is the matrix of technical input coefficients, X is total production, E is exports, and M is imports.
$$d_{ij} = a_{ij} \frac{x_i}{x_i + e_{ij} - m_{ij}}$$
$$U = (I - D)^{-1}$$
$$u_i = \sum_{j=1}^n U_{ij}$$