Try this. Change the second to last line from this
eventtime between dateadd(month, -1, getdate()) and getdate()
datepart(yy,eventtime) = datepart(yy,dateadd(m,-1,getdate())) and datepart(m,eventtime) = datepart(m,dateadd(m,-1,getdate()))
Let us know if this is what you're looking for.
When I did this I got outage duration only for 2 devices (out of 250 more devices) and only 4 instances for the month of July. There are definately more. Any other query that I can try?
I simply modified the window of the report. I assumed that the report was providing the correct information that you wanted for the last 30 days. What are the other types of devices that should've appeared in the report? Of the devices that did appear in the report, how many instances did you expect to appear?