# system.tag.queryTagCalculation not returning my actual minimum and maximum

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331>\
**Category:** Ignition\
**Created:** [October 23, 2019, 7:22pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331 "2019-10-23T19:22:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshuaksutherland](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@joshuaksutherland](https://forum.inductiveautomation.com/u/joshuaksutherland)\
**Post date:** [October 23, 2019, 7:22pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331/1 "2019-10-23T19:22:26Z")

</div>

Good morning everyone,  
I’ve recently been stumped by a problem and I am hoping someone else can offer me some insight into it.

I have a database which stores all my analog values. I need to pull the minimum and maximum from those values for given times. I have attached a .csv file with the actual values in the database for reference.

My problem is I am trying to get the minimum and maximum value for the Well Pump 1 Hours column between 10/22 6:00am and 10/23 6:00am. To do this I use the function system.tag.queryTagCalculation like this:

```auto
tagPaths = ['Well Pump 1/Words/H_TOTAL']
calcs = ['Minimum', 'Maximum', 'Range']
startTime = event.source.parent.getComponent('Date Range').startDate
endTime = event.source.parent.getComponent('Date Range').endDate

event.source.parent.getComponent('Table').data = system.tag.queryTagCalculations(paths=tagPaths, calculations=calcs,startDate=startTime,endDate=endTime)

```

However the query returns 973.0 as the minimum instead of the expected 969.69. When I do a tag historian query using the same start and end time I get the attached CSV file.

Any ideas?

Thanks!

[KM\_Data\_2019-10-20.csv](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/86f2ace11cb7b961e32bf31806b3058d21340410.csv) (37.8 KB)  
Josh

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 23, 2019, 7:46pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331/2 "2019-10-23T19:46:13Z")

</div>

Any possibility it’s an artifact of how you’re displaying the number? (i.e. displaying with one decimal place)

---

<div class="post-metadata">

**Author:** ![joshuaksutherland](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@joshuaksutherland](https://forum.inductiveautomation.com/u/joshuaksutherland)\
**Post date:** [October 23, 2019, 7:58pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331/3 "2019-10-23T19:58:23Z")

</div>

Possibly. How could I test that?

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 23, 2019, 8:21pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331/4 "2019-10-23T20:21:58Z")

</div>

Go into the table customizer (right-click on the table component) and check the numberformat strings.

In the attached screen shot, the first two columns of the table are formatted to show up to two decimal places while the last column is formatted to show up to one decimal place. (## vs #)

![48%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a8010db86c777080e3c47577019f5c632ca4416b.png)

---

<div class="post-metadata">

**Author:** ![joshuaksutherland](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@joshuaksutherland](https://forum.inductiveautomation.com/u/joshuaksutherland)\
**Post date:** [October 23, 2019, 8:54pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculation-not-returning-my-actual-minimum-and-maximum/29331/5 "2019-10-23T20:54:23Z")

</div>

Thank you for the response. They are all set to display to two decimal places. I also took a look at the raw data returned by the function (before it is displayed in the table) and it returns the same thing just to a greater precision.
