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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors