In Section 1.2 of Iwaniec's Spectral Methods of Automorphic Forms, there is a description of Haar measures and modular functions. There is a point where he deduces the modular function for the group of upper triangular matrices; I know how this is done separately, but I don't follow his logic in the book.
First, let me give a few definitions and context from the book. I extract parts from pages 14-15.
If $G$ is a locally compact group, $G$ has a left-invariant Haar measure. This Haar measure is unique up to positive constant multiple. If $\mu$ is the Haar measure, we can define another Haar measure $\mu'$ by $\mu'(S) = \mu(Sh^{-1})$ for any measurable set $S$ and $h \in G$. As $\mu'$ is also left-invariant, we must have that $$ \delta(h) \int_G f(g) d\mu = \int_G f(g) d \mu' = \int_G f(gh) d \mu$$ for some $\delta(h) > 0$. Actually, $\delta: G \rightarrow \mathbb{R}^+$ is a continuous group homomorphism, and we call it the modular function of $G$.
Let $A$ and $N$ denote the positive diagonal matrices and unipotent groups, $$ A = \left\{ a(y) = \begin{pmatrix} \sqrt{y} & \\ & 1/\sqrt{y} \end{pmatrix} : y > 0\right\}$$ and $$ N = \left\{ n(x) = \begin{pmatrix} 1 & x \\ & 1 \end{pmatrix} : x \in \mathbb{R} \right\}.$$ Both $A$ and $N$ are abelian, and thus unimodular (i.e. their left and right Haar measures coincide, or equivalently their modular functions are trivial). In the coordinates above, their Haar measures are $dn = dx$ and $da = y^{-1} dy$.
Let $P = AN$. Iwaniec defines the Haar measure $dp = da dn = y^{-1} dy dx$ on $P$ through $$ \int_P f(p) dp = \int_A \int_N f(an) \, da \, dn.$$ A short computation (essentially noting that $a(y)n(x) = n(xy)a(y)$ and changing variables) shows that $dp$ is left-invariant.
Now we get to the part that I don't follow. By Fubini's theorem, we have that $$\begin{align} \int_A \int_N f(a(y)n(x)) \frac{dx \, dy}{y} &= \int_N \int_A f(n(xy)a(y)) \frac{dx \, dy}{y} \\ &= \int_N \int_A f(n(x)a(y)) \frac{dx \, dy}{y^2}. \end{align}$$ This shows that the modular function of $P$ is $\delta(p) = y^{-1}$ if $p = a(y)n(x)$.
Why does it follow that the modular function of $P$ is $\delta(p) = y^{-1}$ in these coordinates?