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
Junaid11
Helper V
Helper V

If both dates have same month and year

Hello,

I have data in which there are two dates.I  want to create a column based on If the month and year of both dates are same then to have "New Booking" else "Old Booking" 

My data looks like below:

Date 1SalesDate 2
12/01/20211247218/01/2021
27/05/20213455709/02/2021
15/06/20208934519/03/2020

My Outcome would look like this:

Date 1SalesDate 2Status
12/01/20211247218/01/2021New Booking
27/05/20213455709/02/2021Old Booking
15/06/20208934519/03/2020Old Booking

 

1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@Junaid11,

Something like this should work:

Status = IF( AND( YEAR([Date1]) = YEAR([Date2]), MONTH([Date1]) = MONTH([Date2])), "New Booking", "Old Booking" )

 

View solution in original post

1 REPLY 1
rsbin
Super User
Super User

@Junaid11,

Something like this should work:

Status = IF( AND( YEAR([Date1]) = YEAR([Date2]), MONTH([Date1]) = MONTH([Date2])), "New Booking", "Old Booking" )

 

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.