Forum Discussion

baqerbushajea's avatar
baqerbushajea
Regular Visitor
6 years ago
Solved

create shifts by agents with interference

Hello guys, 

i have call center log files i would like to divide agents into two shifts (morning , night ), Morning start from 8:00AM ends 4:00PM 

Night start from 1:00 PM ends 9:00PM , i understand that calls before 1:00 PM "morning" and After 4:00 PM "night" but calls between 1:00 and 4:00 PM is ?? 

i need dax code to decide calls are from morning shift agents or night shift agent? 

thank you 

 

  • AllisonKennedy's avatar
    AllisonKennedy
    6 years ago

    Try something like this, as COLUMNS: 

     

    FirstCallTime = MINX(FILTER('Calls Log', 'Calls Log'[Call Date]=EARLIER('Calls Log'[Call Date]) && 'Calls Log'[Agent]=EARLIER('Calls Log'[Agent])),'Calls Log'[Call Time])
    Shift = IF('Calls Log'[FirstCallTime]<TIMEVALUE ( "1:00 PM" ),"Morning", "Night")

7 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Icon for Community Champion rankCommunity Champion
    How would you decide this by looking at the data? What does your image show? I'm confused by the 5 January, as from looking at the data I would guess that Rawan was on morning shift that day?

    You first need to answer a few questions:
    Does an agent work only morning or night shift each day? If so, just ignore the 1-4pm time slots and look for times before 1p or after 4p and assign morning or night to that agent for that entire day.
    • baqerbushajea's avatar
      baqerbushajea
      Regular Visitor

      thank you so much , you gave me great idea i solved it 

    • baqerbushajea's avatar
      baqerbushajea
      Regular Visitor

      idid create this code 

       

      Shift =

      if('Calls log'[Call Time] < TIMEVALUE ( "1:00 PM" ),"Morning"
              ,IF('Calls log'[Call Time] > TIMEVALUE("4:00 PM") ,"Night" , "Morning "))
      Unfortunately dosen't work , 
       
      • AllisonKennedy's avatar
        AllisonKennedy
        Icon for Community Champion rankCommunity Champion

        Try something like this, as COLUMNS: 

         

        FirstCallTime = MINX(FILTER('Calls Log', 'Calls Log'[Call Date]=EARLIER('Calls Log'[Call Date]) && 'Calls Log'[Agent]=EARLIER('Calls Log'[Agent])),'Calls Log'[Call Time])
        Shift = IF('Calls Log'[FirstCallTime]<TIMEVALUE ( "1:00 PM" ),"Morning", "Night")
  • Anonymous's avatar
    Anonymous
    Not applicable

    HI baqerbushajea ,

     

    Try this column

     

     

    Column =


    IF (
    Table15[Time] >= TIME ( 13, 0, 0 )
    && Table15[Time] <= TIME ( 22, 0, 0 ),
    "Night",
    IF (
    Table15[Time] < TIME ( 13, 0, 0 )
    && Table15[Time] > TIME ( 4, 0, 0 ),
    "Morning",
    "??"
    )
    )
    Regards,
    Harsh Nathani
    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
    • baqerbushajea's avatar
      baqerbushajea
      Regular Visitor

      thank you 

       

      but still facing same issue, 

      the code will result somthing like this 

      what i need is when every the agent is in morning all his calls shift is morning 

       

      please help !!