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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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