We have SQL Server with monthly partitions logging analog every 5 seconds. The QA user would like to select any time range and find out the percentage of temperature above the setpoint during the hot rinse is on. I am trying to use Tag History Binding or Named Query. But it seems I can't use conditions in the expression and if I use Named Query, I will have to union an unknown number of tables.
The logic is
if({Water_Temp_Fahrenheit} > {Water_Temp_Setpoint} && ({Hot_Water_Rinse} = 1 || {Hot_Water_Rinse} = 1), true, false)
Should I use Tag History Binding Wide/Tall/Calculations PointCount/AsStored? Or is there a better way to do this?