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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors