Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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:
Date | Count of Incidents |
30.07.2019 | 2 |
22.07.2019 | 1 |
18.07.2019 | 1 |
04.07.2019 | 1 |
17.06.2019 | 1 |
24.05.2019 | 1 |
07.05.2019 | 1 |
28.03.2019 | 1 |
27.03.2019 | 1 |
05.02.2019 | 1 |
09.04.2018 | 1 |
05.02.2018 | 1 |
26.10.2017 | 1 |
05.07.2017 | 1 |
20.06.2017 | 1 |
18.01.2017 | 1 |
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!
Solved! Go to Solution.
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.
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.
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
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
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |