It looks like your answer is wrong.
The correct change is:
$$\sum_{n\leq N} \sum_{\substack p|n \\ p \text{ prime}} 1= \sum_{\substack p\leq N \\ p\text{ prime}} \sum_{\substack n\leq N \\ p|n} 1 =\sum_{\substack p\leq N \\ p\text{ prime}} \left\lfloor \frac N p\right\rfloor$$
The last step is because:
$$\sum_{\substack n\leq N \\ p|n} 1 = \left\lfloor \frac N p\right\rfloor$$
The key to changing the order of summation is to write out the set of pairs that you are summing over.
In this case, you are summing over all pairs, $(n,p)$ with the condition $p|n$, $n\leq N$ and $p$ is prime. The original form is to sum over all $n$ and then find the corresponding set of $p$. The "change" is to list all possible $p$ first, namely, the primes $p\leq N$, and then list all the $n\leq N$ which are multiples of $p$.
Edit
You can actually remove the condition $p\leq N$ since it is redundant:
$$\sum_{n\leq N} \sum_{\substack p|n \\ p \text{ prime}} 1= \sum_{p\text{ prime}} \sum_{\substack n\leq N \\ p|n} 1 =\sum_{p\text{ prime}} \left\lfloor \frac N p\right\rfloor$$
This is the same result because $\left\lfloor\frac N p\right\rfloor = 0$ when $p>N$.