# USQL a userAction's timeseries graph

**URL:** <https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729>\
**Category:** Real User Monitoring\
**Tags:** user-actions, usql\
**Created:** [September 21, 2023, 5:54pm UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729 "2023-09-21T17:54:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KevThompson](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@KevThompson](https://community.dynatrace.com/u/KevThompson)\
**Post date:** [September 21, 2023, 5:54pm UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/1 "2023-09-21T17:54:34Z")

</div>

Hi All,

I feel this is probably something very simple but im having some issues working out how to do it and i’ve not seen any answers that help.

In our app we have a number of user actions we track with actions, for example screens being viewed, buttons being clicked etc.

Example of screen view tracking.

```auto
val action = Dynatrace.enterAction("Screen view : <app.error_screen>")
action.leaveAction()

```

I need to be able to view these screen views over a time period similar to this graph, for example when Error screens are being shown, so I can see a graph of the last x days and see when problems have occurred.

 ![KevThompson_0-1695318410044.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/8dd6ef82ec85bcbf6efec662af8c1bbe6857b820.png)

Any help is much appreciated.

Thanks

Kev

---

<div class="post-metadata">

**Author:** ![mizso74](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mizso74/32/41729_2.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [September 21, 2023, 10:12pm UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/2 "2023-09-21T22:12:40Z")

</div>

Hi&nbsp;[@KevThompson](https://community.dynatrace.com/user/61329),

Please double check it, but it will not meet your requirements exactly, because it gives back the all action count numbers from the affected sessions:

SELECT DATETIME(startTime, ‘HH:mm’, ‘5m’), SUM (userActionCount) FROM usersession WHERE useraction.application=‘your appliacation name’ AND useraction.name=“your individual user action name” GROUP BY DATETIME(startTime, ‘HH:mm’, ‘5m’)

So it would be closer, because it gives back the session id count where the specific user action can be found. This is not deal with those cases where the specific action can be found more than one.

SELECT DATETIME(startTime, ‘HH:mm’, ‘5m’), COUNT (userSessionId) FROM usersession WHERE useraction.application='your application name’AND useraction.name=“your individual user action name” GROUP BY DATETIME(startTime, ‘HH:mm’, ‘5m’)

I hope it helps.

Best regards,

Mizső

---

<div class="post-metadata">

**Author:** ![KevThompson](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@KevThompson](https://community.dynatrace.com/u/KevThompson)\
**Post date:** [September 22, 2023, 10:50am UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/3 "2023-09-22T10:50:15Z")

</div>

Hi&nbsp;Mizső,

Thanks for the feedback,&nbsp; I’ve tried to use this one but I get the following error,&nbsp; any ideas?

SELECT DATETIME(startTime, ‘2023-09-01 00:00’, ‘5m’), COUNT (userSessionId) FROM usersession WHERE useraction.application='My3 App ’ AND useraction.name=“Screen change : app.dashboard” GROUP BY DATETIME(startTime, ‘2023-09-20 00:00’, ‘5m’)

 ![KevThompson_2-1695379706739.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/3549c38d7edcd305d762aa07b69504ca5f4730e7.png)

Thanks

Kev

---

<div class="post-metadata">

**Author:** ![mizso74](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mizso74/32/41729_2.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [September 22, 2023, 11:03am UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/4 "2023-09-22T11:03:27Z")

</div>

Hi&nbsp;[@KevThompson](https://community.dynatrace.com/user/61329),

Try this one, you should cahnge only the app and the user action name. In this case you will have graph and it can pin to dashboard:

SELECT DATETIME(startTime, '‘HH:mm’, ‘5m’), COUNT (userSessionId) FROM usersession WHERE useraction.application='My3 App ’ AND useraction.name=“Screen change : app.dashboard” GROUP BY DATETIME(startTime, '‘HH:mm’, ‘5m’).

I have not tried it but check to create custom metric (for alerting) and change to graph to single value (maybe it would be better on dashboard with time filter).

Best regards,

Mizső

---

<div class="post-metadata">

**Author:** ![KevThompson](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@KevThompson](https://community.dynatrace.com/u/KevThompson)\
**Post date:** [September 22, 2023, 11:43am UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/5 "2023-09-22T11:43:47Z")

</div>

Excellent thank you&nbsp;Mizső,&nbsp; its working now,&nbsp; &nbsp;the confusion point was I thought you had to put the required date ranges into the DateTime in the query, where as that comes form the timeframe selector.

We have recently moved from another provider which also had its own QL so a few confusing cross over points.

Thanks  
Kev

---

<div class="post-metadata">

**Author:** ![mizso74](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mizso74/32/41729_2.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [September 22, 2023, 12:10pm UTC](https://community.dynatrace.com/t/usql-a-useractions-timeseries-graph/41729/6 "2023-09-22T12:10:27Z")

</div>

Your welcome!&nbsp;:wink::dynaspin:
