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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 @Anonymous

 

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 @Anonymous

 

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!

 

Anonymous
Not applicable

it worked well, thanks a lot!!!

PaulOlding
Solution Sage
Solution Sage

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

 

 

Anonymous
Not applicable

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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