first, i hope i understand your requirement / intended result correctly. A couple of observations upfront:
you do not need to calculate the response time of a span manually, it is done by Dynatrace and available via the duration field, see example.
Your query can never show a number of spans with a response time larger than the maximum as you are using the same timeframe for both queries. So the only possibility is that there are spans with a duration equal to the max, but never larger as the max was already found by the first query. Please clarify and provide more detail on your use case.
Here is my interpretation & example:
There is a certain reference of “performance” for certain requests. This reference can be defined by e.g. the observed response time during a certain timeframe (last business week in my case, or e.g. yesterday). Then, the current performance is compared to that reference and you want to see if your services are performing better or worse than before.
you can copy paste this example and try it on our Playground environment based on real data.
Ultimately in case you need to be alerted in case the response time of your requests exceeds your specified thresholds consider using Dynatrace anomaly detection.