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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
simonandtony
Frequent Visitor

How to see if 2 date columns have the same year month

I am wanting to see which Policies have the same Date Cancelled (Year and Month) and a Date of loss (Year and Month)

 

simonandtony_1-1728627042227.png

 

2 ACCEPTED SOLUTIONS
dk_dk
Super User
Super User

Hi @simonandtony 

You can create a calculated column:

 

 

Matching =

VAR cancelYear = YEAR(Table[DateCancelled_notime])

VAR cancelMonth = MONTH(Table[DateCancelled_notime])

VAR lossYear = YEAR(Table[DateOfLoss])

VAR lossMonth = MONTH(Table[DateOfLoss])

 

RETURN

IF(cancelYear = lossYear && cancelMonth = lossMonth, "Match", "No match")




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

Proud to be a Super User!





View solution in original post

dharmendars007
Super User
Super User

Hello @simonandtony , 

 

1. Go to the Modeling tab in Power BI and create two calculated columns:

 

For Datecancelled:

YearMonth_Cancelled = FORMAT([DateCancelled_notime], "YYYY-MM")

 

For Dateofloss

YearMonth_Loss = FORMAT([DateOfLoss], "YYYY-MM")

 

2. Create another calculated column to check if the YearMonth_Cancelled is equal to YearMonth_Loss:

 

SameYearMonth = IF([YearMonth_Cancelled] = [YearMonth_Loss], "Same Month", "Different Month")

 

3. Add this SameYearMonth column to your report to easily filter or identify policies where the cancellation and loss occurred in the same year and month.

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

2 REPLIES 2
dharmendars007
Super User
Super User

Hello @simonandtony , 

 

1. Go to the Modeling tab in Power BI and create two calculated columns:

 

For Datecancelled:

YearMonth_Cancelled = FORMAT([DateCancelled_notime], "YYYY-MM")

 

For Dateofloss

YearMonth_Loss = FORMAT([DateOfLoss], "YYYY-MM")

 

2. Create another calculated column to check if the YearMonth_Cancelled is equal to YearMonth_Loss:

 

SameYearMonth = IF([YearMonth_Cancelled] = [YearMonth_Loss], "Same Month", "Different Month")

 

3. Add this SameYearMonth column to your report to easily filter or identify policies where the cancellation and loss occurred in the same year and month.

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

dk_dk
Super User
Super User

Hi @simonandtony 

You can create a calculated column:

 

 

Matching =

VAR cancelYear = YEAR(Table[DateCancelled_notime])

VAR cancelMonth = MONTH(Table[DateCancelled_notime])

VAR lossYear = YEAR(Table[DateOfLoss])

VAR lossMonth = MONTH(Table[DateOfLoss])

 

RETURN

IF(cancelYear = lossYear && cancelMonth = lossMonth, "Match", "No match")




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

Proud to be a Super User!





Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.