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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Count Date Rows in Last Month

Hi All,

 

I have a column called 'Dates' this column shows various dates. 

 

Please can you show me the DAX to count the number of rows with dates in the last month?

 

Many thanks,

 

E

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Tim,

 

The formula is shown below;

 

Erected in Past Month = CALCULATE(DISTINCTCOUNT('Standing Scaffold Data'[ErCompleteDate]), PREVIOUSMONTH('Standing Scaffold Data'[ErCompleteDate]) )
 
Sample Data:
 
ErCompleteDate
01/01/2020
01/01/2021
01/02/2021
07/09/2019
etc
 
Regards,
 
E
 
 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Anonymous 

Try use this measure, you can use today's month and then -1.

Erected in Past Month = CALCULATE(DISTINCTCOUNT('Table'[Date]),MONTH('Table'[Date])=MONTH(TODAY())-1)

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
timg
Solution Sage
Solution Sage

Hi Serdet,

You can use this: 

CountDaysLastMonth = CALCULATE(DISTINCTCOUNT(DimDate[Date]), PREVIOUSMONTH(DimDate[Date]))

best regards,

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi Tim

 

I have tried your measure and have received 'blank' in my card visual. I am using the measure by replacing dimdate[date] with my date column. Is this the correct approach?

 

Thanks 

 

E

Hi Serdet,

Yes that's correct. Could you perhaps share your formula and a sample of your date table data?

regards,

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi Tim,

 

The formula is shown below;

 

Erected in Past Month = CALCULATE(DISTINCTCOUNT('Standing Scaffold Data'[ErCompleteDate]), PREVIOUSMONTH('Standing Scaffold Data'[ErCompleteDate]) )
 
Sample Data:
 
ErCompleteDate
01/01/2020
01/01/2021
01/02/2021
07/09/2019
etc
 
Regards,
 
E
 
 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.