cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Divide each value by a specific number in an array - DQL

I have the following DQL query:

timeseries interval: 1d, usage = sum(dt.billing.full_stack_monitoring.usage), from: -7d, to: now()

Essentially, what I want is to divide each value within the array by a specific amount which would then give me my costing under the DPS model. 

 

What DQL function do I use to divide each value within an array

 

1 REPLY 1

Maheedhar_T
Mentor

Hi @badgerfifteen 
iCollectArray is the function which allows iterative operations on the Arrays in DQL.
In your case something like this would help

timeseries interval: 1d, usage = sum(dt.billing.full_stack_monitoring.usage), from: -7d, to: now()
| fieldsAdd actual_usage=iCollectArray(usage[]/100)

Just dividing by 100 here to give an example.

Regards,
@Maheedhar_T 

Maheedhar

Featured Posts