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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
coochy5
Helper II
Helper II

Need to create a shift (days off) calendar in matrix visualisation - overlaid with vacations

Hi there,

Hoping for some assistance, as I've come completely unstuck with this, and not even sure if best handled within Power Query, or in DAX.

Why I don't know which it should be - trying to map the result on a calendar (matrix visualisation), in addition to actual crew vacation days.

 

I need to create a calendar, showing shift off days.  Many shifts, many with the same rotation - are differentiated by crew (colours), and each crew colour, even if on the same rotation, would have a different start date, to not overlap.

(on the visualisation - need a multi-select of the crew colours also)

 

Have tried this...

 

ShiftPattern = DATATABLE(
    "Crew", STRING,
    "DaysOn", INTEGER,
    "DaysOff", INTEGER,
    {
        {"Red"156},
        {"Yellow"156},
        {"Blue"156},
        {"Teal"2213},
        {"Orange"2213},
        {"Purple"2213},
        {"Brown"2213},
        {"Grey"2213},
        {"Magenta"1513},
        {"Pink"1513}
        }
 
Here's the data I'm looking at
IdNameDaysOnDaysOffEffectiveDateIsActiveWorkdayName
1Red15610/23/20241Day Rate / Bulker - 15/6 Rotation 2 (Red)
2Yellow1562/15/20171Day Rate / Bulker - 15/6 Rotation 3 (Yellow)
3Blue1562/22/20171Day Rate / Bulker - 15/6 Rotation 1 (Blue)
4Teal22135/30/20181Day Rate / Bulker / Hourly - 22/13 Rotation 5 (Teal)
5Orange22135/9/20181Day Rate / Bulker / Hourly - 22/13 Rotation 2 (Orange)
6Purple22135/2/20181Day Rate / Bulker / Hourly - 22/13 Rotation 1 (Purple)
7Brown22135/23/20181Day Rate / Bulker / Hourly - 22/13 Rotation 4 (Brown)
8Grey22135/16/20181Day Rate / Bulker / Hourly - 22/13 Rotation 3 (Grey)
9Magenta15134/1/20201Salary - 15/13 Rotation 1 (Magenta)
10Pink15134/15/20201Salary - 15/13 Rotation 2 (Pink)
 
 
This result, is close....but the shift days off are not correct/mapping correctly.
 
coochy5_0-1734463206667.png
(As you'll see....Yellow crew - should all be off shift on the same dates, all Red crew off at the same time (as all other Red crew), but Red would not be off at the same time as Yellow.
(measure for this pbix is 
Colour Format =
IF([Value_per_day] = "V""#fed70d",
IF([Value_per_day] = "U""#fed68d",
IF([IsShiftOffDayMeasure] = 1"#FFB6C1"
)))
 

Still unable to upload pbix....

 
Hoping someone can help ???

9 REPLIES 9
lbendlin
Super User
Super User

lbendlin_0-1734478024824.png

 

Hi there.

Thanks for this.  I thought I was finally following the concept, but not working out for me....

Looked at your pbix - and tried to incorporate into mine...with the two meaures - don't get the same result....

 

This is what I get...still sample data...

 
coochy5_0-1734544370787.png

I've added (and changed the measures - and the conditional formatting)

 

Couple of issues here :

Calendar - dates whilst no real need to show historical dates at all....maybe last 30 days or so - but future dates need to incorporate latest planned vacation day - may be months in the future, not years.

(and of course, the visualisation needs to incorporate the vacation days....I'll attach a table)

 

Ultimate result I'm trying to achieve is a named employee crew schedule - combined with the employee vacation dates... 

 

coochy5_1-1734545129935.png

This is what I've been using:

Value_per_day =
LEFT (
    MAXX (
        FILTER (
            ALLSELECTED ( 'Worker_Vacay' ),
            'Worker_Vacay'[Date] = MAX ( 'Calendar'[Date] )
                && 'Worker_Vacay'[Name] = MAX ( 'Worker_Vacay'[Name] )
        ),
        'Worker_Vacay'[TimeType]
    ),
    1
)
 
Colour Format =
IF([Value_per_day] = "V", "#fed70d",
IF([Value_per_day] = "U", "#fed68d",
IF([IsShiftOffDayMeasure] = 1, "#FFB6C1"
)))

 

 

Worker_Vacay table:

 

NameLastNameFirstNameWD_IDActiveTitleDivisionIdBaseIdDateTimeTypeWorkScheduleCalendarRotationCrew
Owen MoneyMoneyOwen2161Supervisor 3EASPO1/19/2025Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Fred BloggsBloggsFred58601Supervisor 2MOMOO11/28/2024Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Fred BloggsBloggsFred58601Supervisor 2MOMOO11/29/2024Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Fred BloggsBloggsFred58601Supervisor 2MOMOO11/30/2024Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Fred BloggsBloggsFred58601Supervisor 2MOMOO1/21/2025Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Fred BloggsBloggsFred58601Supervisor 2MOMOO4/18/2025Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT12/29/2024Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT11/25/2024Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT11/26/2024Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT12/30/2024Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT11/27/2004Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Dog BarkerBarkerDog21011Operator 4NMHIT12/31/2024Unpaid Time OffDay Rate / Bulker - 15/6 Rotation 2 (Red)15/6Red
Will RodgersRodgersWill99611Operator Frac Blender 4MRIDK12/29/2024Unpaid Time OffDay Rate / Bulker - 15/13 Rotation 1 (Blue)15/13Blue
Will RodgersRodgersWill99611Operator Frac Blender 4MRIDK12/10/2024Unpaid Time OffDay Rate / Bulker - 15/13 Rotation 1 (Blue)15/13Blue
Will RodgersRodgersWill99611Operator Frac Blender 4MRIDK12/11/2024Unpaid Time OffDay Rate / Bulker - 15/13 Rotation 1 (Blue)15/13Blue
Kathy FingerFingerKathy22231Assistant ExecutiveCOCAT12/24/2024Vacation (Days)Day Rate / Bulker - 15/6 Rotation 4 (Purple)15/6Purple
Kathy FingerFingerKathy22231Assistant ExecutiveCOCAT12/30/2024Vacation (Days)Day Rate / Bulker - 15/6 Rotation 4 (Purple)15/6Purple
Sean PottsPottsSean103411Tech IISAPOD12/17/2024Vacation (Days)22/13 (Black)22/13Black
Sean PottsPottsSean103411Tech IISAPOD12/18/2024Vacation (Days)22/13 (Black)22/13Black
Sean PottsPottsSean103411Tech IISAPOD1/2/2025Vacation (Days)22/13 (Black)22/13Black
Sean PottsPottsSean103411Tech IISAPOD12/16/2024Vacation (Days)22/13 (Black)22/13Black
Brianna WilliamsWilliamsBrianna141Supervisor 1EASPO11/29/2024Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 3 (Yellow)15/6Yellow
Nicky FasterhausFasterhausNicky12651Operator 1GPCTC1/1/2025Unpaid Time Off (Days)Day Rate / Bulker - 15/6 Rotation 3 (Yellow)15/6Yellow

What happens after they took a vacation?  does their rotation schedule reset?

Hi.  Nothing would happen. 

Presumption is they stay on the same schedule until they leave or change jobs.

Also presumed, is that they would not record vacation days if the shift is off...

 

If the days do turn out to be the same...doesn't really matter how it's shown, as they would still be off...so displaying it as vacation or shift off doesn't matter.  It's an implied available/onshift calendar unless a vacation day is booked, or the entire shift is off.

 

 

You would use the shift calendar (which is based on WorkdayName/group) and then EXCEPT it with the vacation table for that particular individual.

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Hi.

Thanks again for the response.

Just for clarity - I hope :

Vacations are recorded events (dates) - in a worker vacation table.

Shift days off - need to be calculated.

Trying to combine both of these into a matrix visualisation.

 

Have mocked up the result I'm looking for in excel - sample names/titles etc - real dates, real schedules.

coochy5_0-1734623926487.png

 

This is the vacation data I used....

NameTitleBaseIdDivisionIdDateTimeTypeWorkScheduleCalendarRotationCrew
Adam FrohlichSupervisor  1GPCCT1/15/2025Unpaid Time Off (Days)15/6 Rotation 2 (Red)15/6Red
Bob JensenSupervisorSPOEA12/21/2024Vacation (Days)15/6 Rotation 3 (Yellow)15/6Yellow
Bob JensenSupervisorSPOEA12/22/2024Vacation (Days)15/6 Rotation 3 (Yellow)15/6Yellow
Brad JensenSupervisor CATCO12/31/2024Vacation (Days)15/6 Rotation 1 (Blue)15/6Blue
Brett PittsOperator 3IDKMR12/18/2024Unpaid Time Off (Days)15/6 Rotation 2 (Red)15/6Red
Brian EalesSupervisor 3GPCCT12/29/2024Unpaid Time Off (Days)15/6 Rotation 1 (Blue)15/6Blue
Cletus TomsOperator 1GPCFR1/8/2025Unpaid Time Off15/6 Rotation 1 (Blue)15/6Blue
Cletus TomsOperator 1GPCFR1/14/2025Unpaid Time Off15/6 Rotation 1 (Blue)15/6Blue
Drake BlinderOperator 4MOOMO12/18/2024Unpaid Time Off15/6 Rotation 3 (Yellow)15/6Yellow
Drake BlinderOperator 4MOOMO12/20/2024Unpaid Time Off15/6 Rotation 3 (Yellow)15/6Yellow
Dustin Hoff ManSupervisor 2RDCFR1/2/2025Unpaid Time Off (Days)15/13 Rotation 1 (Magenta)15/13Magenta
Enid BlytonSupervisor 1RDCFR12/23/2024Unpaid Time Off (Days)15/13 Rotation 2 (Pink)15/13Pink
Enid BlytonSupervisor 1RDCFR12/27/2024Unpaid Time Off (Days)15/13 Rotation 2 (Pink)15/13Pink
Eranda SamuelOperator 3HNTFR12/28/2024Unpaid Time Off15/6 Rotation 2 (Red)15/6Red
Eranda SamuelOperator 3HNTFR12/29/2024Unpaid Time Off15/6 Rotation 2 (Red)15/6Red
Fred BloggsOperator 1PODSA12/25/2024Parental (Days)15/6 Rotation 2 (Red)15/6Red
Fred BloggsOperator 1PODSA12/27/2024Parental (Days)15/6 Rotation 2 (Red)15/6Red
Mowgli GeneralOperator 2GPCCT12/21/2024Unpaid Time Off22/13 Rotation 5 (Teal)22/13Teal
Mowgli GeneralOperator 2GPCCT12/22/2024Unpaid Time Off22/13 Rotation 5 (Teal)22/13Teal
Plumber BobSupervisor 1RDCFR12/29/2024Unpaid Time Off (Days)15/6 Rotation 2 (Red)15/6Red
Robert BealesSupervisor 3GPCCT12/18/2024Unpaid Time Off (Days)15/6 Rotation 1 (Blue)15/6Blue
Robert BealesSupervisor 3GPCCT12/23/2024Unpaid Time Off (Days)15/6 Rotation 1 (Blue)15/6Blue
Rough ApprenticeSupervisor 2RDCCT12/20/2024Unpaid Time Off (Days)15/6 Rotation 3 (Yellow)15/6Yellow
Sean EwesOperator 2HITNM12/20/2024Unpaid Time Off15/6 Rotation 3 (Yellow)15/6Yellow
Sean EwesOperator 2HITNM12/22/2024Unpaid Time Off15/6 Rotation 3 (Yellow)15/6Yellow

 

The shift schedules would be generated from this data:

Here's the data I'm looking at
IdNameDaysOnDaysOffEffectiveDateIsActiveWorkdayName
1Red15610/23/20241Day Rate / Bulker - 15/6 Rotation 2 (Red)
2Yellow1562/15/20171Day Rate / Bulker - 15/6 Rotation 3 (Yellow)
3Blue1562/22/20171Day Rate / Bulker - 15/6 Rotation 1 (Blue)
4Teal22135/30/20181Day Rate / Bulker / Hourly - 22/13 Rotation 5 (Teal)
5Orange22135/9/20181Day Rate / Bulker / Hourly - 22/13 Rotation 2 (Orange)
6Purple22135/2/20181Day Rate / Bulker / Hourly - 22/13 Rotation 1 (Purple)
7Brown22135/23/20181Day Rate / Bulker / Hourly - 22/13 Rotation 4 (Brown)
8Grey22135/16/20181Day Rate / Bulker / Hourly - 22/13 Rotation 3 (Grey)
9Magenta15134/1/20201Salary - 15/13 Rotation 1 (Magenta)
10Pink15134/15/20201Salary - 15/13 Rotation 2 (Pink)
 

We are missing the third table - the employees. There can be employees that are not in the vacation list.

 

We are also looking at a SCD scenario - how should employees changing teams/shifts  be handled?

 

lbendlin_0-1734744477198.png

 

Any further assistance is greatly appreciated - I'm finding this a very tricky challenge !

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.