Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8560119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:12:19+00:00 2026-06-11T16:12:19+00:00

I’m having the toughest time trying to solve this issue at work. I don’t

  • 0

I’m having the toughest time trying to solve this issue at work. I don’t even know how to ask the question to be honest. I want to get the peak counts of calls that occurred during the same time.

I tried by breaking down the date range into minutes (resulting in a huge data set) and getting a count of calls that occurred during these times but the counts were off (I was off by a factor of 10) since I know the total calls.

1 | 2012-01-01 01:15:00.000 | 2012-01-01 01:16:00.000
2 | 2012-01-01 01:14:00.000 | 2012-01-01 01:17:00.000
3 | 2012-01-01 01:18:00.000 | 2012-01-01 01:20:00.000

The during the first calls datetime range, 2 calls happened (itself and number 2). Same with 2. Call 3 no calls happened during that datetime range. This is pretty simplified since we’re talking about datetime ranges throughout the day that may range many minutes or only a few seconds. I need to find the peak per month. So for this example, January would have a peak of 2 (I don’t need to know the date range that decided the number)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:12:20+00:00Added an answer on June 11, 2026 at 4:12 pm

    This is my preferred way. It starts with a list of all the times when calls start or stop, and then calculates the number of simultaneous calls:

    with t as (
         select starttime as thetime, 1 as isstart, 0 as isend
         from calls
         union all
         select endtime, 0 as isstart, 1 as issend
         from calls
       ),
       t2 as (
         select thetime, row_number() over (order by thetime) as numcalls,
                isstart, isend,
                row_number() over (partition by isstart order by thetime) as cumstartsorends
         from t
        ),
       t3 as (
         select thetime,
                (case when isstart = 1 then cumstartsorends
                      else numcalls - cumstartsorends
                 end) as numstarts,
                (case when isend = 1 then cumstartsorends
                      else numcalls - cumstartsorends
                 end) as numends
          from t2
         )
    select year(thetime) as yr, month(thetime) as mon,
           max(numstarts - numends) as maxcum
    from t3
    group by year(thetime), month(thetime)
    

    What this query really wants to do is a cumulative sum on each time (start time or end time. However, that is not supported until 2012.

    So, it does a trick. It calculates the cumulative number of starts and stops. However, these are only on the start time or end time record. To get the other value, it also calculates the total starts and stops, and subtracts this value. So, each time stamp has the cumulative number of starts and stops. The difference is the number of concurrent calls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Does anyone know how can I replace this 2 symbol below from the string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.