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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
makalikratia
New Member

Compare Dates only by day and hours (without minutes and seconds)

Hi everyone,

 

I would like to compare two dates and pay attention only to the day and the hour, minute and second should not be considered.

 

Example:
Date A: 02/25/2021 03:05:55
Date B: 02/25/2021 03:23:20

 

Compare_Dates = if Date A = Date B then 1 else 0

 

At the moment this results in the value 0, but should be 1

 

Looking forward to your help!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@makalikratia , Try like

if(format([Date A] , "YYYYMMDD HH:MM") =format([Date B] , "YYYYMMDD HH:MM"),1,0)

 

But example dates are not equal at min level

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@makalikratia , Try like

if(format([Date A] , "YYYYMMDD HH:MM") =format([Date B] , "YYYYMMDD HH:MM"),1,0)

 

But example dates are not equal at min level

Thanks it's working with your function! Only hours should be the same, so all fine (i deleted the MM part).

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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