# Can I use double aggregation (sum → percentile) in Dynatrace Metric Selector?

**URL:** <https://community.dynatrace.com/t/can-i-use-double-aggregation-sum-percentile-in-dynatrace-metric-selector/54232>\
**Category:** Open Q&A\
**Tags:** dynatrace-managed\
**Created:** [November 27, 2025, 11:58am UTC](https://community.dynatrace.com/t/can-i-use-double-aggregation-sum-percentile-in-dynatrace-metric-selector/54232 "2025-11-27T11:58:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachins0412](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@sachins0412](https://community.dynatrace.com/u/sachins0412)\
**Post date:** [November 27, 2025, 11:58am UTC](https://community.dynatrace.com/t/can-i-use-double-aggregation-sum-percentile-in-dynatrace-metric-selector/54232/1 "2025-11-27T11:58:03Z")

</div>

Hi Everyone

i have a custom metric and each data point represents the duration of a single activity/phase within a workflow. A workflow consists of multiple phases.

Example:

Workflow 1 phases: 1 ms, 2 ms, 30 ms, 10 s → total workflow duration = 10,033 ms

Workflow 2 phases: 2 ms, 3 ms, 15 ms, 10 s → total workflow duration = 10,020 ms

I want to calculate the median of total workflow durations (p50).  
That is, first sum all phases for each workflow, then take the median across workflows.

I can currently get the sum of phases per workflow using:

tenant.workflow.phases.latency.count  
:filter(eq(“operation”, “ONBOARD”))  
:splitBy(“workflow\_id”)  
:fold(sum)

This gives me workflow\_id + total duration.

Is there a way to apply percentile (e.g., p50) on this folded result using Metric Selector syntax(because DQL is not available on my dynatrace instance probably) , essentially doing a double aggregation (sum → percentile) in a single metric selector?

I’ve tried things like:  
:fold(sum):percentile(50)  
but it results in a syntax error&nbsp;  
Illegal transform operator: Found unsupported aggregation :percentile(50)

would like to know if what i am trying to do is possible using metric selector query ? any suggestions would be appreciated
