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
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
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