Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
smather
Helper III
Helper III

Queue Time

Hi there

 

I have a list of calls, with their queue time, which looks a little like this:

 

Handled00:00:10
Abandoned00:01:06
Handled00:00:52
Handled00:04:00

 

and there's a couple of things I want to do but for the life of me I can't figure out. The first thing is: 

 

I want to say if the status is handled and the queue time is -

equal to or less then 00:00:10 then say "blah"

more than 00:00:10 and less than or equal to 00:00:20 then say "blah2"

more than 00:00:20 and less than or equal to 00:00:30 then say "blah3"

more than 00:00:30 and less than 00:00:60 then say "blah3"

equal to or more than "00:00:60" then say "blah5"

 

but i cannot figure out either the right M code or Dax for this (I don't care if it's a measure or a custom column)

 

The second thing I want to do is pretty much the same, but if the status was abandoned and only anything 10 secs or above. 

 

Any ideas would be a massive help, thank you 🙂 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@smather,

 

This solution uses both M and DAX. Since the Queue Time is text, you need to convert it to seconds. In Power Query, split the Queue Time column on the colon delimiter and change the type to whole number:

 

DataInsights_0-1626271839432.png

 

Create a calculated column (DAX) to convert Queue Time to seconds:

 

Total Seconds = 
( Table1[Queue Time Hour] * 3600 ) + ( Table1[Queue Time Minute] * 60 ) + Table1[Queue Time Second]

 

Create a calculated column (DAX) for the Category:

 

Category = 
VAR vStatus = Table1[Status]
VAR vSeconds = Table1[Total Seconds]
VAR vResult =
    SWITCH (
        TRUE (),
        vStatus = "Handled"
            && vSeconds <= 10, "<= 10",
        vStatus = "Handled"
            && vSeconds > 10
            && vSeconds <= 20, "10 - 20",
        vStatus = "Handled"
            && vSeconds > 20
            && vSeconds <= 30, "20 - 30",
        vStatus = "Handled"
            && vSeconds > 30
            && vSeconds < 60, "30 - 60",
        vStatus = "Handled"
            && vSeconds >= 60, ">= 60",
        vStatus = "Abandoned"
            && vSeconds >= 10, "Abandoned"
    )
RETURN
    vResult

 

Result:

 

DataInsights_2-1626272288031.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@smather,

 

This solution uses both M and DAX. Since the Queue Time is text, you need to convert it to seconds. In Power Query, split the Queue Time column on the colon delimiter and change the type to whole number:

 

DataInsights_0-1626271839432.png

 

Create a calculated column (DAX) to convert Queue Time to seconds:

 

Total Seconds = 
( Table1[Queue Time Hour] * 3600 ) + ( Table1[Queue Time Minute] * 60 ) + Table1[Queue Time Second]

 

Create a calculated column (DAX) for the Category:

 

Category = 
VAR vStatus = Table1[Status]
VAR vSeconds = Table1[Total Seconds]
VAR vResult =
    SWITCH (
        TRUE (),
        vStatus = "Handled"
            && vSeconds <= 10, "<= 10",
        vStatus = "Handled"
            && vSeconds > 10
            && vSeconds <= 20, "10 - 20",
        vStatus = "Handled"
            && vSeconds > 20
            && vSeconds <= 30, "20 - 30",
        vStatus = "Handled"
            && vSeconds > 30
            && vSeconds < 60, "30 - 60",
        vStatus = "Handled"
            && vSeconds >= 60, ">= 60",
        vStatus = "Abandoned"
            && vSeconds >= 10, "Abandoned"
    )
RETURN
    vResult

 

Result:

 

DataInsights_2-1626272288031.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors