# Display Total per Day on Dashboard

**URL:** <https://forums.losant.com/t/display-total-per-day-on-dashboard/4923>\
**Category:** Help\
**Tags:** dashboard\
**Created:** [February 7, 2023, 9:23am UTC](https://forums.losant.com/t/display-total-per-day-on-dashboard/4923 "2023-02-07T09:23:20Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [February 7, 2023, 11:20pm UTC](https://forums.losant.com/t/display-total-per-day-on-dashboard/4923/3 "2023-02-07T23:20:14Z")

</div>

I’ve attached a workflow file that will hopefully help get you started. You’ll definitely want to tweak it to fit for your use:

[set-daily-count-develop.flow](https://forums.losant.com/uploads/short-url/3Gnu2K7JiBVJnDHf8ELw23qyIaX.flow) (4.2 KB)

Here’s an explanation of the nodes used:

 ![Screen Shot 2023-02-07 at 18.01.44](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/d/d67a58a0bd51ee53d56462a916b123592ce31d59.png)

- [Device: State Trigger](https://docs.losant.com/workflows/triggers/device/) - Activates any time the selected device sends a device state report containing any attribute **other than** the `newCount` attribute that we’ll be defining downstream. For this example, let’s say the “total cycles since boot” attribute is called `totalCount` and is available on the initial payload at `data.totalCount`.

- [Storage: Get Value Node](https://docs.losant.com/workflows/data/get-value/)) - We’re using workflow storage to store the previously reported `totalCount` value, from the previous execution of this workflow. Let’s call this `lastTotalCount` and place it on the payload as `working.lastTotalCount`.

- [Math Node](https://docs.losant.com/workflows/logic/math/) - Here I used `max( ( {{ data.totalCount }} - {{ working.lastTotalCount }} ), 1 )`. This determines the difference between `data.totalCount` and `working.lastTotalCount`. The result is stored as `working.newCount`.

- [Device: Update Node](https://docs.losant.com/workflows/data/update-device/) - Creates a new attribute on the device called `newCount`, if the attribute doesn’t already exist on the device.

- [Device: State Node Output Node](https://docs.losant.com/workflows/outputs/device-state/) - Sets the `newCount` attribute value on the device from `{{working.newCount}}`.

- [Storage: Set Value Node](https://docs.losant.com/workflows/data/store-value/) - Now that we’re done referencing the old `working.lastTotalCount` value from workflow storage, we’re going to update it to the newly reported value we received on the payload at `data.totalCount`.

Now you have a `newCount` attribute on the device. In a [Bar Chart](https://docs.losant.com/dashboards/blocks/bar-chart/) (or other time series dashboard block), you can set the Aggregation to `Sum`, which will add up all of the `newCount` values reported within the selected Duration (e.g. 24 hours):

 ![Screen Shot 2023-02-07 at 18.06.07](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/9/97c0f7d0fc5d059c4bb8f8424400405c1c3bddea.jpeg)

Hopefully this is helpful! If you have any other questions, please don’t hesitate to ask.

---

_[View the full topic](https://forums.losant.com/t/display-total-per-day-on-dashboard/4923)._
