# How to plot a graph comparing successful API hits today vs. same day last week?

**URL:** <https://community.dynatrace.com/t/how-to-plot-a-graph-comparing-successful-api-hits-today-vs-same-day-last-week/54323>\
**Category:** DQL\
**Tags:** dql, dashboards, charts, timeseries\
**Created:** [December 7, 2025, 11:20pm UTC](https://community.dynatrace.com/t/how-to-plot-a-graph-comparing-successful-api-hits-today-vs-same-day-last-week/54323 "2025-12-07T23:20:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![subair-appakkan](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@subair-appakkan](https://community.dynatrace.com/u/subair-appakkan)\
**Post date:** [December 7, 2025, 11:20pm UTC](https://community.dynatrace.com/t/how-to-plot-a-graph-comparing-successful-api-hits-today-vs-same-day-last-week/54323/1 "2025-12-07T23:20:28Z")

</div>

I want to create a time-series chart in Dynatrace that shows the number of successful API hits for **today** and compares it to the same day last week (aligned by time of day).

I currently have a query that gives me the total count:

```auto
fetch user.events, scanLimitGBytes:-1
| filter app.bundle == "com.my.package"
| filter http.response.status == 200
| summarize count()

```

This works for totals, but I need:

- A **graph** showing progression throughout the day.
- Two series: **Today (Sunday)** and **Last Sunday** (or same weekday last week).
- Ideally aligned so 00:00 today compares to 00:00 last week.

What’s the correct DQL syntax or recommended approach to achieve this? Should I use makeTimeseries or bin()? And how do I shift last week’s timestamps forward for overlay?  
A sample image is attached.

Any examples or best practices would be appreciated!

 ![sample_api_hits_today_vs_last_week.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/5/25009e179659177b7a555269be5d7e38c3ad0b4b.png)

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [December 8, 2025, 3:27am UTC](https://community.dynatrace.com/t/how-to-plot-a-graph-comparing-successful-api-hits-today-vs-same-day-last-week/54323/2 "2025-12-08T03:27:10Z")

</div>

[@subair-appakkan](https://community.dynatrace.com/user/93825)&nbsp; Here is an example for memory, you can use similar logic for your use case

```markup
timeseries today = avg(dt.host.memory.usage), 
  from:now() - 24h, to:now(),
  by: {dt.entity.host},
  filter: dt.entity.host== "HOST-XXX"

| fieldsAdd lastWeek = lookup ([timeseries mem = avg(dt.host.memory.usage),   
  from:now() - 7d - 24h, to:now() - 7d,
  by:{dt.entity.host},
  filter: dt.entity.host == "HOST-XXX"],
  sourceField:dt.entity.host, lookupField:dt.entity.host)[mem]

```

---

<div class="post-metadata">

**Author:** ![subair-appakkan](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@subair-appakkan](https://community.dynatrace.com/u/subair-appakkan)\
**Post date:** [December 8, 2025, 8:08am UTC](https://community.dynatrace.com/t/how-to-plot-a-graph-comparing-successful-api-hits-today-vs-same-day-last-week/54323/3 "2025-12-08T08:08:36Z")

</div>

I could not make it in the mobile application context.
