Forum Discussion

pstew12's avatar
pstew12
Frequent Visitor
6 years ago
Solved

Get max concurrent call count by the hour

Hi Everyone,

 

I have call logs where I am trying to find the overlapping calls to figure out the max concurrent calls I have every hour. 

 

Data Example:

JoinTimeLeaveTime
3/8/18 8:01 AM3/8/18 9:38 AM
3/8/18 8:04 AM3/8/18 9:38 AM
3/8/18 9:03 AM3/8/18 9:39 AM
3/8/18 9:09 AM3/8/18 9:39 AM
3/8/18 9:23 AM3/8/18 9:29 AM
3/8/18 9:23 AM3/8/18 9:29 AM
3/8/18 9:30 AM3/8/18 9:56 AM

 

What I need to come up with is the following

Hour of day (24hr)Max Calls
01
12
22
38
42
53
67
70
84
94
103
113
124
133
145
153
163
173
184
195
204
213
222
233

 

Any ideas to point me in the right direction? I don't even know where to start.

 

  • pstew12 ,

     

    Firstly generate a 24h series table using dax:

    Hours = GENERATESERIES(0, 23, 1)

    Then you can create a table like below, you can add other conditions in the switch expression.

    Result Table = 
    SELECTCOLUMNS (
        Hours,
        "Hour of day(24hr)", Hours[Value],
        "Max Calls", SWITCH (
            Hours[Value],
            8, CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    'Table',
                    NOT (
                        HOUR ( 'Table'[JoinTime] ) >= 9
                            || HOUR ( 'Table'[LeaveTime] ) < 8
                    )
                )
            ),
            9, CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    'Table',
                    NOT (
                        HOUR ( 'Table'[JoinTime] ) >= 10
                            || HOUR ( 'Table'[LeaveTime] ) < 9
                    )
                )
            )
        )
    )

     

    Please also refer to the pbix file attached.

     

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

7 Replies

    • pstew12's avatar
      pstew12
      Frequent Visitor

      Thats helpful but how can I do it over a 24 hour period? 

       

  • v-yuta-msft's avatar
    v-yuta-msft
    Icon for Community Support rankCommunity Support

    pstew12 ,

     

    Firstly generate a 24h series table using dax:

    Hours = GENERATESERIES(0, 23, 1)

    Then you can create a table like below, you can add other conditions in the switch expression.

    Result Table = 
    SELECTCOLUMNS (
        Hours,
        "Hour of day(24hr)", Hours[Value],
        "Max Calls", SWITCH (
            Hours[Value],
            8, CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    'Table',
                    NOT (
                        HOUR ( 'Table'[JoinTime] ) >= 9
                            || HOUR ( 'Table'[LeaveTime] ) < 8
                    )
                )
            ),
            9, CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    'Table',
                    NOT (
                        HOUR ( 'Table'[JoinTime] ) >= 10
                            || HOUR ( 'Table'[LeaveTime] ) < 9
                    )
                )
            )
        )
    )

     

    Please also refer to the pbix file attached.

     

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • pstew12's avatar
      pstew12
      Frequent Visitor

      Ok, If I want to filter by date how can I make this dynamic?

       

      • v-yuta-msft's avatar
        v-yuta-msft
        Icon for Community Support rankCommunity Support

        pstew12 ,

         

        I'm afraid this couldn't be achieved because power bi doesn't support dynamic calculate table.

         

        Community Support Team _ Jimmy Tao

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I dont want to count mutually exclusive count repeatedly. For eg. if there are mutually exclusive calls like

      C1 from 8:00 to 8:05 ,

      C2 from 8:06 to 8:10 

      C3 from 8:11 to 8:15.

       

      By the method explained above for 8, it will give count =3 but I want the count as 1 

      i.e. excluding mutually exclusive calls because they will be sharing the resource or license

  • Hello @pstew12!

    I am currently encountering the same problem you had, I need to calculate the maximum number of simultaneous calls for each hour of the day. Did you manage to get it out?

    Thanks in advance.

    Greetings,

    Bibi