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
Anonymous
Not applicable

Create a simple date/time with a formula

Hello

 

I try to create a datetime based on a IF condition but i can't manage to do it. I would like to transform any datetime that starts after 09 AM to a datetime that starts at 09AM.

I guess it should be simple and i apologize for being so dull

 

This is the formula i am using :

 

Heure début corrigée = if(hour(Calendriers[Début]) < 9;DATEVALUE(year(Calendriers[Début]) & "/" & month(Calendriers[Début]) & "/" & day(Calendriers[Début]) & " 09:00:00");Calendriers[Début])
 
 

Problem is "29/05/2020 08h00" is transformed to "29/05/2020 00h00", not to "29/05/2020 09h00".

 

If anyone has time to help me, i would greatly appreciate it.

 

Best regards

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

if(hour([datetime])<9 , [datetime].date + time(9,0,0) , [datetime])

 

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

if(hour([datetime])<9 , [datetime].date + time(9,0,0) , [datetime])

 

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
Anonymous
Not applicable

Thank you so much, works like a charm

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.