cancel
Showing results for 
Search instead for 
Did you mean: 
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 IV
Super User IV

@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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
amitchandak
Super User IV
Super User IV

@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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

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

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.