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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
baqerbushajea
Regular Visitor

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? 

snip.jpgthank you 

 

1 ACCEPTED SOLUTION

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")

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

7 REPLIES 7
harshnathani
Community Champion
Community Champion

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)

thank you 

 

but still facing same issue, 

the code will result somthing like this 

baqerbushajea_1-1593087164448.png

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

 

please help !! 

amitchandak
Super User
Super User

@baqerbushajea ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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 , 
 

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")

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

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.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors