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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
georgec96
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?

 

Thanks 

2 REPLIES 2
amitchandak
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

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors