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
------------------------------
Sign up
Already have an account? Login
Login to the community
Login with Quickbase US – quickbase.com Login with Quickbase EU – quickbase.eu
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.