Does order in a DQL query matter?

I think you should consider doing the filter at the root of the query instead. I do not think the order matters here, you need to specify filter twice as you have in the final version of the query. If you share the full query, maybe it is possible to simplify it.

Hope that helps.