# Sort by ascending Code Calculated Metric - Data explorer

**URL:** <https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993>\
**Category:** Open Q&A\
**Tags:** dynatrace-managed, data-explorer, dashboards-classic\
**Created:** [February 2, 2022, 7:27pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993 "2022-02-02T19:27:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ca6iya](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@ca6iya](https://community.dynatrace.com/u/ca6iya)\
**Post date:** [February 2, 2022, 7:27pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993/1 "2022-02-02T19:27:21Z")

</div>

created free connection pool percentage on WebLogic process metrics. Cannot sort by highest percentage value. Trying to check if someone found way to resolve issue.

Metrics used for calculation

builtin:tech.weblogic.connectionPool.ActiveConnectionsCurrentCount

builtin:tech.weblogic.connectionPool.MaxCapacity

---

<div class="post-metadata">

**Author:** ![Dallas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dallas/32/31233_2.png) [@Dallas](https://community.dynatrace.com/u/Dallas)\
**Post date:** [February 2, 2022, 7:43pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993/2 "2022-02-02T19:43:45Z")

</div>

Hello,

When using the data explorer you should see a “+” symbol in the UI which allows you to add the “Sort by” functionality seen here:

 ![Dallas_0-1643830636671.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/5/6508d62a04a0d1054b792328a173110adae17809.png)

Once that is selected you will be able to choose Ascending or descending. I would also suggest using the “last value” selection if you are trying to see the current value being reported.

 ![Dallas_2-1643830992208.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/1/b1d6f5de4133a6c69f70bdc82c9cd6d97793d6de.png)

If you are trying to use the code tab then you can see under the “Sort” section there is the possibility to add “ascending” or “descending”. Seen here in the metric selector documentation:

> **[Metrics API - Metric selector](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/metric-selector)**
>
> Configure the metric selector for the Metric v2 API.

builtin:tech.weblogic.connectionPool.ActiveConnectionsCurrentCount:splitBy(“dt.entity.process\_group\_instance”):avg:auto:**sort(value(avg,descending)**)

Hope this helps.

Thanks

-Dallas

---

<div class="post-metadata">

**Author:** ![ca6iya](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@ca6iya](https://community.dynatrace.com/u/ca6iya)\
**Post date:** [February 2, 2022, 8:43pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993/3 "2022-02-02T20:43:31Z")

</div>

added last part to calculation and it worked. Thanks

:sort(value(avg,descending))\*100

 ![mcabiya_0-1643834600313.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/9/c9ecce043f3de3cad8752578985f2f4b29136ae1.png)

---

<div class="post-metadata">

**Author:** ![DavidB](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DavidB](https://community.dynatrace.com/u/DavidB)\
**Post date:** [April 12, 2022, 4:29pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993/4 "2022-04-12T16:29:36Z")

</div>

Hello mcabiya,

could you share how did u make the metric calculation?

Thank you in advance.

Best Regards,

David

---

<div class="post-metadata">

**Author:** ![ca6iya](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@ca6iya](https://community.dynatrace.com/u/ca6iya)\
**Post date:** [April 12, 2022, 5:10pm UTC](https://community.dynatrace.com/t/sort-by-ascending-code-calculated-metric-data-explorer/33993/5 "2022-04-12T17:10:43Z")

</div>

I used tag to filter process. Try adding tag or removing filter from metric.

(builtin:tech.jvm.memory.pool.used:filter(and(in(“dt.entity.process\_group\_instance”,entitySelector(“type(process\_group\_instance),tag(~“TAG~”)”)))):splitBy(“dt.entity.process\_group\_instance”))/(builtin:tech.jvm.memory.pool.max:filter(and(in(“dt.entity.process\_group\_instance”,entitySelector(“type(process\_group\_instance),tag(~“TAG~”)”)))):splitBy(“dt.entity.process\_group\_instance”)):sort(value(avg,descending))\*100
