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! Learn more

Reply
Anonymous
Not applicable

Rolling count showing zeros for a specified time-period

Hi There,

 

I am trying to create an automated report that, for each month, it shows the number of incidents in the past 6 months. For that, I have two tables, a Date table (which you can see on the screenshot below), and an Incidents table such as the one shown here:

 

DateCount of Incidents
30.07.20192
22.07.20191
18.07.20191
04.07.20191
17.06.20191
24.05.20191
07.05.20191
28.03.20191
27.03.20191
05.02.20191
09.04.20181
05.02.20181
26.10.20171
05.07.20171
20.06.20171
18.01.20171

 

image.png

 

The formulas I am using to make the plot are as follows:

Measure for the Y axis:

 

Incidents_last_6Months = 
CALCULATE(
    COUNTROWS(Incidents),
    DATESINPERIOD('Date'[Date], [Max Date], -6, MONTH)
)

 

 

Calculated column that provides the X axis for the plot:

 

Year Month = RELATED('Date'[Year Month])

 

 

 

My current problem is that I would like it to show zeros for the months that were zero incidents. I have tried to put a "+0" in the DAX formula "Incidents_last_6Months", but then it shows the whole period (from 2017 to 2019), filled up with zeros.

 

Does anybody have a solution for such issues?

 

Thank you in advance!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi perm

 You could refer to my sample to see whether it work or not.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
dax
Community Support
Community Support

Hi perm,

According to your description, it seems that when you add 0 , it will apply for all date, right? If so, you could try to refer to my sample to see whether it work or not.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi Zoe Zhi,

 

Thank you very much for your answer! I actually tried to add the zero, but it did not work. I checked your sample, and it does not quite apply.

 

I made a sample file with two different approaches to the problem (one on each tab). You can find the file under this link: https://drive.google.com/file/d/1U7vMhGDYFiGyndUeUFlCQDt3wplScgp1/view?usp=drivesdk

 

Hopefully, this can explain my case better.

 

Best regards,

Marti

 

dax
Community Support
Community Support

Hi perm

 You could refer to my sample to see whether it work or not.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi dax,

 

Thank you very much, this is definitely what I was looking for!

I realised I was totally missing the second "slicer" table 🙂

 

Best regards,

Marti

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors