What you want to achieve is not difficult, a gradient texture and some math nodes will get you there.
First, I added a linear gradient texture rotated on the y axis by 90 degrees. With that, you have a gradient going from black (or 0) at the bottom of the building to white (or 1) at the top. But what we want is a gradient going from black to white on each floor, that’s where the modulo operation comes in. With the node setup you provided, I found that “1/102.68” as the second parameter of the modulo math node gives the best results (102.68 being exactly 4 times the scale of the brick texture). Now we have a gradient on each floor but there is a problem, it doesn’t go from 0 to 1 as we want it to. Fixing that problem is very easy, we only need to multiply the result of the modulo by 102.68 (again, 4 times the scale of the brick texture). The last step is to plug the output of the multiply math node to the strength input of the emission shader. And that’s it, you now have a gradient on each window of your building.
gradient on windows.blend
As a bonus I made a more complex version, adding blinds with different colors on the windows.
gradient on windows advanced.blend
In both .blend files, the nodes that I added are in red.