Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Night shift calculation

Hi everyone,


I have a table with 3 columns : date&time, user, quantity.


I'm looking for a formula that can let me calculate the total transactions for every user on a night shift that goes from Sunday till Friday 22:00:00 till 06:00:00


I am not able to group by day and sum the total quantity per user as it's not capturing the whole shift (it's only capturing 2 hours from previous day and 6 hours from next day)


Is there any way I can capture the whole night shift as one day?



Super User
Super User

@georgec96 , These columns can help


Shift = If(Timevalue([Datetime]) >= Time(22,0,0) && Timevalue([Datetime]) < Time(6,0,0), "Night", "Normal")


Week Start date = Datevalue([Datetime])+-1*WEEKDAY(Datevalue([Datetime]),2)+1

Hi @amitchandak ,

This doesn't seem to work properly as it only adds a column with "Normal" only values even if the time is night shift.

Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors