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
jnbelair85
New Member

Help required to count rows in table from last month and from 2 months ago

Hello,

 

I had found a measure that worked fine until 2023 came and now my following formulas dont work as the last month and 2 months ago fall in 2022. I want to count the number of rows from my tables that have a date in the current month, last month and two months ago.

 

Here is my current month:

This month = CALCULATE(COUNTROWS('boite support mobilité') , FILTER(ALL('boite support mobilité'[DateTimeReceived]),MONTH('boite support mobilité'[DateTimeReceived]) =MONTH(TODAY())))
 
Here is last month:
Last month = CALCULATE(COUNTROWS('boite support mobilité') , FILTER(ALL('boite support mobilité'[DateTimeReceived]),MONTH('boite support mobilité'[DateTimeReceived]) =MONTH(TODAY())-1))
 
Two months ago:
Two months ago =  CALCULATE(COUNTROWS('boite support mobilité') , FILTER(ALL('boite support mobilité'[DateTimeReceived]),MONTH('boite support mobilité'[DateTimeReceived]) =MONTH(TODAY())-2))
 
I need a way to add the year roll over but I am not findsing anything that works.. help!
1 REPLY 1
vicky_
Super User
Super User

Instead of using FILTER(Table), you should use the DATESINPERIOD or PARALLELPERIOD function, which can handle the year roll-overs. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors