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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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