cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FerChavirock
Frequent Visitor

Creating a Shift Column Based of Date/Time

I have a column "TIME_STAMP" and I want to assign shifts based on the following time ranges:

"1er." = 6:00:00-15:29:59, "2do." = 15:30:00-23:53:59, "3er." = 23:54:00-5:59:59

FerChavirock_0-1623864063693.png

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @FerChavirock

 

It works well in my environment, please check the data type.

vxulinmstf_0-1624264361304.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

4 REPLIES 4
v-xulin-mstf
Community Support
Community Support

Hi @FerChavirock

 

It works well in my environment, please check the data type.

vxulinmstf_0-1624264361304.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

it worked well, thanks a lot!!!

PaulOlding
Solution Supplier
Solution Supplier

You could add a calculated column with this DAX:

Shift =
SWITCH(TRUE(),
'Time (to Seconds)'[Time] < TIME(6,0,0), "3er",
'Time (to Seconds)'[Time] < TIME(15,30,0), "1er",
'Time (to Seconds)'[Time] <= TIME(23,59,59), "2do",
"3er")

PaulOlding_1-1623870810072.png

 

 

I added the column but the result is not as expected

TURNO1 = SWITCH(

TRUE(),

HOURLY_OUTPUT_CURRENT[TIME_STAMP] < TIME(6,0,0), "3RO",

HOURLY_OUTPUT_CURRENT[TIME_STAMP] < TIME(15,30,0), "1RO",

HOURLY_OUTPUT_CURRENT[TIME_STAMP] <= TIME(23,53,59), "2DO",

"OTHER")

FerChavirock_2-1623883585210.png

any idea what could be wrong?

 

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors