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! Learn more

Reply
Chrism123
Frequent Visitor

Comparing Month and Year of Two dates

Hi,

 

I hope someone can help me with this problem.

 

I would like to compare Year and Month of two dates but I only know how to compare either month or year.

 

=CALCULATE('Measure'[Sales]+'Measure'[Backlog];

FILTER(all(date[Order Date]);

month(date[Order Date])=month([Last Batch Date])))

 

 

Thanks!

1 ACCEPTED SOLUTION

Maybe try month(date[Order Date])=month([Last Batch Date])&&year(date[Order Date])=year([Last Batch Date]) instead?

View solution in original post

4 REPLIES 4
jthomson
Solution Sage
Solution Sage

You should just be able to add the same syntax you've used for the month section for the year as another argument in your calculate function

Hi, I already tried this, but it I get an error because there is only a maximum of 2 arguments allowed for the FILTER-function.

Maybe try month(date[Order Date])=month([Last Batch Date])&&year(date[Order Date])=year([Last Batch Date]) instead?

Thank you! 🙂 I think that works!

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.

Top Solution Authors