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
Anonymous
Not applicable

Shift wise Date time and grouping

 

Untitled.png

Hello ,
I have date and time data using i want to calcualate Shift

Shift A: 6AM to 2PM
Shift B: 2PM to 10PM
Shift C: 10PM to 6AM

how i calculate last shipt becouse that is in next 4 hr

 

 

Regards ,
pooja

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous,

 

I'd like to suggest you add calculated column to marking tag. Then you only need to calculate out nearest time to find out the correspond ship.

Category = 
VAR hour =
    HOUR ( [Time] )
RETURN
  "Shift "&  IF ( hour >= 6 && hour < 14, "A", IF ( hour >= 14 && hour < 22, "B", "C" ) )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
javieezy
Helper I
Helper I

Hi, what if my shift ends at 10:30? 

jhaldane
Frequent Visitor

Hi

Please can you support me from scratch with a similar query below.

1. How do i separate date and time and then

2. How do i create Shifts. Shift 1 06:00 - 14:00, Shift 2 14:00 - 22:00 and Shift 3 22:00 - 06:00

Would really apprecite your support

Thanks

Jerry

 

 

 

Anonymous
Not applicable

Hello @jhaldane,
Seperate date and time Using split option is available.
and then no need of date on only using time you can write conditions like

Category = 
VAR hour =
    HOUR ( [Time] )
RETURN
  "Shift "&  IF ( hour >= 6 && hour < 14, "A", IF ( hour >= 14 && hour < 22, "B", "C" ) )

its may help
Regard ,
pooja

v-shex-msft
Community Support
Community Support

HI @Anonymous,

 

I'd like to suggest you add calculated column to marking tag. Then you only need to calculate out nearest time to find out the correspond ship.

Category = 
VAR hour =
    HOUR ( [Time] )
RETURN
  "Shift "&  IF ( hour >= 6 && hour < 14, "A", IF ( hour >= 14 && hour < 22, "B", "C" ) )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin Sheng and comunity, I have tried this:

Category = 
VAR hour =
    HOUR ( [Time] )
RETURN
  "Shift "&  IF ( hour >= 6 && hour < 14, "A", IF ( hour >= 14 && hour < 22, "B", "C" ) )

but it did not work. Any advice?

Thx a lot.

Karol

Hi, what if my shift ends at 10:30? 

Did you solved this? I have smilar problem.

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.