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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
StuartSmith
Power Participant
Power Participant

Count number of rows from previous month

I have a table that have various coumns including "Start Date".  I am trying to create a measure that will display the number of rows with the "Start Date" as the previous month.  So as an example if we are in Feb 22, I want to display the number of rows that have the start date in Jan 22.

 

I have tried various other solutions found on the web, but cant get any to work.

 

Thanks in advance

1 ACCEPTED SOLUTION

@StuartSmith If that code works then you can update the code like below just to avoid that filter.

Measure = CALCULATE(COUNTROWS('HR Data'), All('Dates'),PREVIOUSMONTH('Dates'[Date]))

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

5 REPLIES 5
StuartSmith
Power Participant
Power Participant

OK, Figured out that there is a page fiilter that is preventing the value from being displayed, although unsure why this page filter would prevent the mesaure from counting/displaying the rows dated for the previous month (Jan) as the page filter is only to show anticipated start dates on or after 01/011/22 and on or before 31/12/22 to is within range.  

 

Can anyone assist?

 

@StuartSmith If that code works then you can update the code like below just to avoid that filter.

Measure = CALCULATE(COUNTROWS('HR Data'), All('Dates'),PREVIOUSMONTH('Dates'[Date]))

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

I just figured that by adding "All" it will remove the filters, and show a value, but its the incorrect value. Now that i know the casue (filter), I should be able (hopefully) to get a workaround.

 

StuartSmith
Power Participant
Power Participant

Hi, I tried your solution referrencing the "Date" table which I already had created and that displayed "(Blank)".

Measure = CALCULATE(COUNTROWS('HR Data'), PREVIOUSMONTH('Dates'[Date]))
I therefore tried the below and this also displays (Blank).
Measure = CALCULATE(COUNTROWS('HR Data'), PREVIOUSMONTH('HR Data'[Anticipated Start Date]))
 
Any ideas?
Samarth_18
Community Champion
Community Champion

Hi @StuartSmith ,

 

Please try:-

Measure = CALCULATE(countrow(table), PREVIOUSMONTH('Datetable'[date])) 

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.