lol not sure how much help ill be here i don't have SQL db to hand and iv not encountered this problem off to a good start but ill try my best to help. what id do in your case is rebuild the statement and see what it is getting caught but firstly can you run the query in your db? and can you query the table a with no other conditions where and selects
FROM table a
see if i can actually get records based on the select statement then simply add in the other factors also maybe remove the brackets 
That's where it gets strange; as far as I know, it's not a problem with SQL, but in the handoff to the reports. The query returns information just fine, even when running it from the web interface on the Select Datasource part of the report. But when you go to build the chart, nothing.
I had to rework a few of my own sql based charts as well, you are correct that the problem is not that the query broke it's that they made some changes to how the custom chart resource works and the sticking point seems to be those two data grouping options that used to be optional and are now required. After mucking with it for a while I ended up just hardcoding in a column to feed it for the "legend shows" value because the data set i was working with didnt need to be grouped up into multiple lines. Once I had that in place it all started rendering correctly. It would seem to me that for your chart you should be using Facility for both the group by and legend shows options, so it will group them by the facility and also show those FAC1/2/3 values as the caption at the bottom of the chart for each line. Since your query itself is so heavily redacted I can't load it up on my server to play with it but hopefully that gives you something to work with.
Loop1 Systems: SolarWinds Training and Professional Services