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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.