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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Sairam_11
Frequent Visitor

Assigning shift based on live timing - SQL

Hello All,

 

Im trying to map the shift based on the timings that are being arrived from backend of SQL data and i have used this formula (

shift = MAXX(filter('Table (2)',Table[datetime]>='Table (2)'[starttime] && Table[datetime] <='Table (2)'[endtime] ),'Table (2)'[shift]),
but yet i cannot arrive at the expected result.
 
The shift timing are given below.
Shift          Start Time  End Time
First06:00:0013:59:59
General08:30:0005:00:00
Second02:00:0022:00:00
Third22:00:0005:59:00
 
A solution will help me progress.
2 REPLIES 2
Sairam_11
Frequent Visitor

Hi @amitchandak , Thanks for your reply!

 

Enclosed for your kind perusal.

Assign Shift.pbix

 

 

amitchandak
Super User
Super User

@Sairam_11 , This formula seems fine to me for a new column in Table looking into table 2 you have shared above

 

shift = MAXX(filter('Table (2)',Table[datetime]>='Table (2)'[starttime] && Table[datetime] <='Table (2)'[endtime] ),'Table (2)'[shift])

 

Can you please share what is wrong? Share data for both tables to test

 

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.