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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
valQuentine
Frequent Visitor

Can we change the value of StartOfDay to a different HOUR instead of 12:00:00 of each day?

I have this scenario:

 

Instead of each StartOfDay to be 12:00:00, the TradingDay begins at 5:00:00 AM of each day. So, my solution is to make a custom column that will determine the correct TradingDate for each transaction based on the given condition (i.e. 5:00:00 AM start of Trading Day). I got it to work in Excel thru HOUR() function but I can't get it to work in powerBI. My Excel formula is shown below.

 

=IF(HOUR(DateTime)>4,TEXT(DATE(YEAR(DateTime),MONTH(DateTime),DAY(DateTime)+1),"mm/dd/yyyy"),TEXT(DATE(YEAR(DateTime),MONTH(DateTime),DAY(DateTime)),"mm/dd/yyyy"))

 

=time.hour([DateTime]) is not working in my case. I don't know what's wrong. I have tried this:

 

TradDate = IF(Time.Hour([DateTime])>4,[DateTime]+1,[DateTime])

 

And it returned an error "Failed to resolve name Time.Hour. It is not a valid table, variable, or function name."

 

Can you help me with this please? 

 

Thanks a lot.

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@valQuentine

You may need a calculated column as below 

TradDate = IF(HOUR('Table'[datetime])>4,DATEVALUE('Table'[datetime])+1,DATEVALUE('Table'[datetime]))

And then format it to "mm/dd/yyyy".

 

Capture.PNG

View solution in original post

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee

@valQuentine

You may need a calculated column as below 

TradDate = IF(HOUR('Table'[datetime])>4,DATEVALUE('Table'[datetime])+1,DATEVALUE('Table'[datetime]))

And then format it to "mm/dd/yyyy".

 

Capture.PNG

Thank you very much @Eric_Zhang

Chihiro
Solution Sage
Solution Sage

Is it DAX?

Then just use HOUR([DateTime]). Time.Hour is PowerQuery function.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.