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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kaushik_asv
Frequent Visitor

Dates - Shift times

Hello all, 

 

We run 2 shifts each day. Blue shift from 6.00 AM - 4.59 PM and Red shift runs from 5.00 PM - 3.59 AM. 

Looking to make a bar graph with Daily output on Y-axis on and Date field on X axis with shift as a legend.

Capture.PNG

I ran into a problem here. Ideally the data for Aug 31 is showing Blue shift without issues. Red shift crosses over between 2 dates. issue here is, I only see a small part of red shift data for that day. The rest of that data is carried over to September 1st. Also, for Aug 31, I will be seeing data from red shift of Aug 30th. 

 

Is there a way I could create a column to reflect the correct totals?

 

Thanks in advance.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

The following formula in a new column @kaushik_asv will look at the time and if it is before 4am (3:59:59 am or earlier) will roll it back a day.

edhans_0-1598911232482.png

if DateTime.Time([End Shift]) < #time(4,0,0) then 
Date.AddDays(DateTime.Date([End Shift]), -1)
else DateTime.Date([End Shift])

 

If you need more help, please provide sample data per the links below, and expected results.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

The following formula in a new column @kaushik_asv will look at the time and if it is before 4am (3:59:59 am or earlier) will roll it back a day.

edhans_0-1598911232482.png

if DateTime.Time([End Shift]) < #time(4,0,0) then 
Date.AddDays(DateTime.Date([End Shift]), -1)
else DateTime.Date([End Shift])

 

If you need more help, please provide sample data per the links below, and expected results.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors