# Optimise the query to join multiple dimensions in Data Explorer

**URL:** <https://community.dynatrace.com/t/optimise-the-query-to-join-multiple-dimensions-in-data-explorer/39958>\
**Category:** Dashboarding\
**Tags:** dynatrace-managed, data-explorer\
**Created:** [May 29, 2023, 3:28pm UTC](https://community.dynatrace.com/t/optimise-the-query-to-join-multiple-dimensions-in-data-explorer/39958 "2023-05-29T15:28:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgarzon1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rgarzon1/32/11844_2.png) [@rgarzon1](https://community.dynatrace.com/u/rgarzon1)\
**Post date:** [May 29, 2023, 3:28pm UTC](https://community.dynatrace.com/t/optimise-the-query-to-join-multiple-dimensions-in-data-explorer/39958/1 "2023-05-29T15:28:49Z")

</div>

Hi

I’ve got this custom metric from a log resource, and I’m trying to figure out if I can optimize this query to get a cool SLO.

i have been giving it a shot, but I just can’t seem to make it work

(&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“400”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“401”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“403”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“404”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“406”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“409”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“410”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“500”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“501”)))):sum():default(0))&nbsp; &nbsp; +&nbsp;(log.azure.test.apiid:filter(and(or(eq(“azuremngm.apiid”,APIv1)),or(eq(“azuremngm.responsecode”,“503”)))):sum():default(0)))

---

<div class="post-metadata">

**Author:** ![rgarzon1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rgarzon1/32/11844_2.png) [@rgarzon1](https://community.dynatrace.com/u/rgarzon1)\
**Post date:** [May 29, 2023, 7:25pm UTC](https://community.dynatrace.com/t/optimise-the-query-to-join-multiple-dimensions-in-data-explorer/39958/2 "2023-05-29T19:25:35Z")

</div>

i know that i can do something like this, but it just looks so awful that i refuse to accept that its the only way.

 ![rgarzon1_0-1685388311605.png](https://global.discourse-cdn.com/dynatrace/original/2X/b/b844976f80bc32891b9a8d0469000d40afc8ea96.png)

---

<div class="post-metadata">

**Author:** ![rgarzon1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rgarzon1/32/11844_2.png) [@rgarzon1](https://community.dynatrace.com/u/rgarzon1)\
**Post date:** [June 20, 2023, 1:01am UTC](https://community.dynatrace.com/t/optimise-the-query-to-join-multiple-dimensions-in-data-explorer/39958/3 "2023-06-20T01:01:52Z")

</div>

at the end the easy way its use prefix

:filter(or(prefix(“azuremngm.responsecode”,4),prefix(“azuremngm.responsecode”,5))
