19 Jun 2024 01:37 PM - last edited on 20 Jun 2024 07:21 AM by MaciejNeumann
Hello,
I want to configure a tile with data explorer and set a comparison metric between 1 week ago and the week preceding it dynamically (without setting a custom timeframe manually).
I found that i could insert a timeshift in the advanced mode of data explorer, but if i set 1w or 2w, it takes all the values from now to 1 or 2 weeks a go. And what i want to produce is an interval from 2w ago to 1w ago, and then from 1 week ago to now to have a comparison between the two following weeks.
Is it possible with something like timeshift(2w to 1w) or is there no way to do it ?
Thanks,
Solved! Go to Solution.
19 Jun 2024 08:53 PM
Hi @Sonia_A ,
This can be done with DQL. You can convert your query to DQL using notebooks. Please refer to this article.
Re: Easily convert Data explorer queries to dql for Dashboards, Notebooks and other apps - Dynatrace...
Then for the timeframe conversion you can use something like this in your DQL which gives you data for the timeframe you requested.
timeseries sum(dt.cloud.aws.alb.errors.alb.http4xx), by:{dt.source_entity.type, dt.source_entity, dt.entity.aws_application_load_balancer, aws.resource.name, aws.region, aws.credentials, aws.account.id, metric.key, dt.system.bucket},interval:1h, from: bin(now()-14d, 1d) , to: bin(now()-7d, 1d)
| fieldsAdd dt.entity.aws_application_load_balancer.name = entityName(dt.entity.aws_application_load_balancer)
| limit 20
Here the part interval:1h, from: bin(now()-14d, 1d) , to: bin(now()-7d, 1d) is the timeframe selector which gives you data of last week. We wrap the time interval in "bin" to round it off to the start of the day.
Hope this helps.
Regards,
@Maheedhar_T