Query for Min and Max values and the time for report


I need to query for the min and max and there time stamp from tag history between the StartDate and EndDate of the report.

Thanks for any help

Fill in your column name, your table name, the name of your time stamp column. The ? will bring up parameter boxes at the bottom to insert your report parameters in the format {StartDate} and {EndDate}

SELECT max(myColumn), min(myColumn) 
FROM myTable
where t_stamp between ? and ?

EDIT I missed your part about it being tag history. when you press the + button to add a data source, it should have an option for Tag Historian.

Sorry so I already have a table that uses tag historian, I just want to be able to display the min and max values from this table separately

Try looking in your data panel on left side of the design window. Try selecting ‘show calculations’, then look at your tag history data source it should have max, min, total, etc.

Use a script data source. Since you already have the raw data (if I understood correctly), you just need to extract the value column as a list, then pass that list to the python builtin min and max functions. Place the results in the data dictionary under keys of their own.

This works however i need it to also show the timestamp for when it reached the min and max values