I need to know the maximum amount of concurrent transactions (calls, employees, etc.) that are happening during each transaction by minute and report that maximum for each transaction. My thought is to create a function where I can pass a start date/time, end date/time, a range of potentially concurrent start date/times and a range of potentially concurrent end date/times and then call that function from each transaction row. I'm thinking the UDF would take the start date/time, loop through the ranges to find concurrent transactions, and store the number of concurrent transactions in an array. The UDF would increment the start date/time by one minute and keep looping and storing the number of concurrent transactions until it hit the end date/time for that transaction. The UDF would then take the maximum number of concurrent transactions from the array and return that number back as the result of the function. The data would not need to be sorted for the UDF to work and I could copy and use the UDF on next month’s data by just referencing the correct transaction date/times and potentially concurrent date/times.
This seems complex to write and time-consuming to run, especially since once the function works I need to add one more complicating factor to only count concurrent transactions if another variable is also true (concurrent transaction times have to be for the same call center, employee, etc.)
Am I making this too hard? I’d really appreciate any advice as to how to create this function.
This seems complex to write and time-consuming to run, especially since once the function works I need to add one more complicating factor to only count concurrent transactions if another variable is also true (concurrent transaction times have to be for the same call center, employee, etc.)
Am I making this too hard? I’d really appreciate any advice as to how to create this function.