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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Deimantas
Frequent Visitor

Date Minu Day

Hi Guys, 

Unofrnutultey I can't find opened thread for this issue.

All I'm trying to use is if the function and the return value are true should be the date column -1 day if false return the same day. 

At first, I try to use: 

if [Hour]>=0 and [Hour]<=5 then [Date]-1 else [Date]  

But true value returnins if fales (because formating of the statemtn won't match ) 

The i try :

if [Hour]>=0 and [Hour]<=5 then Text.From(DateTime.Date(Date(Date.AddDays([Date],-1)))) else [Date]

Unfortunutelly still have error. 

Deimantas_0-1674222275770.png
Please help! 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Deimantas ,

 

This should work:

if [Hour] >= 0 and [Hour] <= 5 then Date.AddDays([Date], -1) else [Date]

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Deimantas ,

 

This should work:

if [Hour] >= 0 and [Hour] <= 5 then Date.AddDays([Date], -1) else [Date]

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thank you for your replay, it's working! 

Thanks. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.