# Totalize runtime and Daily Flow Average and Hourly Flow Average

**URL:** <https://forum.inductiveautomation.com/t/totalize-runtime-and-daily-flow-average-and-hourly-flow-average/86544>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 28, 2024, 8:54pm UTC](https://forum.inductiveautomation.com/t/totalize-runtime-and-daily-flow-average-and-hourly-flow-average/86544 "2024-02-28T20:54:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jyoti\_Kumar](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Jyoti\_Kumar](https://forum.inductiveautomation.com/u/Jyoti_Kumar)\
**Post date:** [February 28, 2024, 8:54pm UTC](https://forum.inductiveautomation.com/t/totalize-runtime-and-daily-flow-average-and-hourly-flow-average/86544/1 "2024-02-28T20:54:07Z")

</div>

I'm trying to create Totalize runtime and Daily Flow Average and Hourly Flow Average.  
New in Ignition

```python

totalizer_tag_path = "[default]Tags1/Totalizer_Tag"
data_tag_path = "[default]Tags1/Flow_Data_Tag"

def update_totalizer(tag, previousValue, value, quality, timestamp):
# Get the current totalizer value
current_totalizer = system.tag.readBlocking(totalizer_tag_path).value
system.util.getLogger(current_totalizer)
#current_totalizer = system.tag.read(totalizer_tag_path).value

```

# Calculate the change in data value

data\_change = value.value - previousValue.value

```python

```

type or paste code here

```python
    # Log the current values
    system.util.getLogger("Totalizer Script").info("Current Totalizer Value: %s", current_totalizer)
    system.util.getLogger("Totalizer Script").info("Data Change: %s", data_change)
    
    # Update the totalizer value
    new_totalizer = current_totalizer + data_change
    system.tag.write(totalizer_tag_path, new_totalizer)
    system.util.getLogger("Totalizer Script").info("New Totalizer Value: %s", new_totalizer)

# Subscribe to the data tag changes
`system.tag.writeBlocking(data_tag_path, update_totalizer)`

```
