Power BI Extend Calendar with Shifts or hours

I needed to drill down to Shifts / hours for my Operations visuals.

Basically I created a new table which extends Calendar with shift beginning times.

CalendarOps = 
ADDCOLUMNS (
    CROSSJOIN (
        CalendarClosed,
        UNION (
            ROW ( "Time", TIME ( 6, 0, 0 ) ),
            ROW ( "Time", TIME ( 18, 0, 0 ) )
            )
    ),
    "DateTime", [Date] + [Time],
    "Hour", HOUR ( [Time] )
)

Then created new DateTime column in my transaction table which is combination of Date & Shift beginning hours (DateTime = Date + Time works) and a Shift column shows Shift1 or Shift2.

You need to change recently created date / time columns data type.

Finally created a relation from CalendarOps.DateTime column to Operations.DateTime column. ( Offcourse it has another relation with my original Calendar table. )

Simple but effective.

Leave a Reply

Your email address will not be published. Required fields are marked *