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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SSJ011
Frequent Visitor

Create Calculated column to get the correct date

Hi, 

 

Want to get the correct date from the completion date and Time with one condition.

 

if the date & time is before 6:30 AM in the Completed column then the calculated column should take yesterday's date else date updated in the

Completed DateCalculated Column Result
11/20/2020 06:29:0011/19/2020
11/20/2020 06:31:0011/20/2020

 

Thanks in advance for your assistance.

 

Regards

Sachin Jagdale   

2 REPLIES 2
Anonymous
Not applicable

Hello,

 

You can use this conditional in a calculated column to get the correct date:

 

=IF(TIME(HOUR([Completed Date]),MINUTE([Completed Date]),SECOND([Completed Date]))<TIME(6,30,0),[Completed Date]-1,[Completed Date])

 

And if you want the correct date to have no time, you could use this:

 

=IF(TIME(HOUR([Completed Date]),MINUTE([Completed Date]),SECOND([Completed Date]))<TIME(6,30,0),[Completed Date]-1-TIME(HOUR([Completed Date]),MINUTE([Completed Date]),[Completed Date]-TIME(HOUR([Completed Date]),MINUTE([Completed Date]))

 

Regards

 

Jesus

camargos88
Community Champion
Community Champion

@SSJ011 ,

 

Try this measure:

 

Column = 
    IF(
        TIME(HOUR('Table'[Date]), MINUTE([Date]), SECOND([Date])) < TIME(6, 30, 00),
        DATEVALUE([Date] - 1),
        DATEVALUE([Date])
    )

 

Capture.PNG

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors