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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.