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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Creating a shift model

I analyse user numbers, and I would like to divide the work day into early (6 am- 2 pm),  late (2 pm- 10 pm) and night shifts (10 pm- 6 am). Creating the night shift is no problem because it runs every weekday from 10pm - 6 am. IIt is difficult for me to create the early and late shift, because they change every week. In calendar week 48 group A has the early shift (6 am- 14 pm) and group B the late shift (2 pm- 10 pm). In calendar week 49 group B has the early shift and group A the late shift and so on.

I would be very grateful for helpful tips!

2 REPLIES 2
Anonymous
Not applicable

My Data looks like this (each row is a user):DataData

 

My Conditional Column looks like this:

CodeCode

 

This is ok but I need to adjust the weekly change from the early and late shift group.

Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Hard to be specific without source data. But, if you created an hours table like this:

 

R06_Table = 
VAR __Hours = 
        SELECTCOLUMNS(
            GENERATESERIES(1 , 12 , 1),
            "Hour",
            [Value] & ":00:00 "
        )
VAR __Period = 
    SELECTCOLUMNS(
        { ("AM"),("PM") },
        "AM/PM",
        [Value]
    )
VAR __HoursAMPM = GENERATEALL(__Hours, __Period)
VAR __Final = 
    SELECTCOLUMNS(
        ADDCOLUMNS(
            __HoursAMPM,
            "Time",
            TIMEVALUE([Hour] & [AM/PM])
        ),
        "Time",
        CONVERT(TODAY() & " " & [Time], DATETIME)
    )
RETURN
    __Final

 

You could create a Shift column like this:

 

Shift = 
VAR __1stBegin = 9
VAR __2ndBegin = 17
VAR __3rdBegin = 1
VAR __Time = TIMEVALUE('R06_Table'[Time])
VAR __Hour = HOUR(__Time)
RETURN
SWITCH(TRUE(),
    __Hour >= __1stBegin && __Hour < __2ndBegin,"First",
    __Hour >= __2ndBegin || __Hour < __3rdBegin,"Second",
    "Third"
)

 

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.