Error due to downsampling an image I have two images $I_1$ and $I_2$ suppose $I_2 = downscale(I_1)$, so for example if $I_1$ has resolution 1024x1024 $I_2$ could be 512x512.

How can I measure how much quality I've lost during this process?

I was thinking to do something like the following, but I'm not sure it's the most correct way to deal with such problems.

I take $I_2$, I upscale it to the same resolution of $I_1$, giving me $\tilde{I}_2$ (by any algorithm, it could be for example replicating pixels value, bilinear interpolation, etc...)

At this point I would use as measure

$$
\mu = \max_{(x,y)} \left\{ 1 - \frac{\tilde{I}_2(x,y)}{I_1(x,y)}\right\}
$$

However I'm not sure this would correspond to the signal to noise ratio.
It would be clear to me that $\tilde{I}_2(2x,2y) = I_1(2x,2y)$ (i.e. pixels with even indices won't change), but when at least one index is odd there will be some reconstruction error (noise?) that the measure would take into account.

So again, is the one above a valid measure? if not what's a better measure?
You compute the maximum relative error there. The problem is that errors that go the other way are unaccounted for (these yield a negative value, you are missing an abs to account for those errors).

Other common options include mean square error, mean absolute error, maximum absolute error, SSIM, and a long list of et ceteras.

What the best approach is depends entirely on your definition of quality, and which type of error you think is more important.