25 Mar 2025
04:24 AM
- last edited on
26 Mar 2025
08:25 AM
by
MaciejNeumann
Is there a way to replace values on a timeseries metric using the min aggregation?
So lets say we have example data like (5,15,50,20,9) and we want to apply min(10) and the timeseries will be converted to (5, 10, 10, 10, 9).
Kind regards
Solved! Go to Solution.
25 Mar 2025 11:16 AM
You can do this with by using an iterative expression within an if statement.
data record(data = array(5,15,50,20,9))
| fieldsAdd newData = if(data[]<10, 10, else: data[]) // iterate through array elements and replace anything less than 10 with value 10. Else, keep current value.
25 Mar 2025 01:51 PM
I am sorry, I was referring to Data Explorer and Classical Metric expressions, not DQL.
Any idea how to implement this in Data Explorer?
26 Mar 2025 09:58 AM
@MartinKulov Sure there is a solution.
You need to use :partition , apply the :filter and then substitute it using the :default transformation.
See an example in the playground tenant.