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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
djj13
Regular Visitor

Creating Business Date in Date Table

I have a report that is generated by our Point-of-Sale system. The report has the date/time a check is opened and when it is closed.

 

Our business day for this report runs from 3:00AM - 2:59 AM. I need to add a date column to represent the business/transaction day. 

 

Open Date/Time AFTER 1/1/2020 3:00:00 AM  Close Date/Time BEFORE 1/2/2020 2:59:00 AM =  Business Date of 1/1/2020.

 

Examples:

 

Open Date/Time          Close Date/Time               Business Date

1/1/2020 09:00:00 AM    1/1/2020 09:30:00 AM    1/1/2020

1/1/2020 11:00:00 PM    1/2/2020 01:30:00 AM    1/1/2020

1/2/2020 01:00:00 AM    1/2/2020 02:00:00 AM    1/1/2020

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@djj13 , Try a new column like

 

Business Date =
Switch( true(),
hour([Open Date/Time]) >= 3 , [Open Date/Time].date , // or use date(year([Open Date/Time]), month([Open Date/Time]), day([Open Date/Time])) ,
hour([Close Date/Time]) < 3 ,[Open Date/Time].date  -1,
[Open Date/Time].date
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@djj13 , Try a new column like

 

Business Date =
Switch( true(),
hour([Open Date/Time]) >= 3 , [Open Date/Time].date , // or use date(year([Open Date/Time]), month([Open Date/Time]), day([Open Date/Time])) ,
hour([Close Date/Time]) < 3 ,[Open Date/Time].date  -1,
[Open Date/Time].date
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you! This worked. I tried using [Open Date/Time].date but received a syntax error for the date function.

 

dj.

mahoneypat
Microsoft Employee
Microsoft Employee

You can use a column expression like this to do that.

 

Business Date 2 = var thisdate = DATE(YEAR('Table'[Open Date/Time]), MONTH('Table'[Open Date/Time]), DAY('Table'[Open Date/Time]))
return if(HOUR('Table'[Open Date/Time])<3, thisdate -1, thisdate)
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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