PaulPeterson1
4 years agoQrew Assistant Captain
Formula Query for Average Duration?
I am trying to use a formula query to calculate the average duration an activity is open. With a little help, I have a query to get the Count and I tried to use that query in a SumValues function to get the total duration then divide that by the count to get my average. The theory sounded good, but the results were not what I was expecting. All of the results came out in the billions. This is what I am trying, please help me find my glitch.
var text tableID = "?????????";
var number currentYear = Year(Today());
var text query = "{'140'.EX.'1'}AND{'126'.EX." & [Month] & "}AND{'138'.EX." & $currentYear & "}";
var number totalDuration = SumValues(GetRecords($query, $tableID), 117);
If([Count] > 0, $totalDuration / [Count])
------------------------------
Paul Peterson
------------------------------
var text tableID = "?????????";
var number currentYear = Year(Today());
var text query = "{'140'.EX.'1'}AND{'126'.EX." & [Month] & "}AND{'138'.EX." & $currentYear & "}";
var number totalDuration = SumValues(GetRecords($query, $tableID), 117);
If([Count] > 0, $totalDuration / [Count])
------------------------------
Paul Peterson
------------------------------