RMS of a complex waveform
Yes, the formula is correct. If you reverse engineer it a bit, it will make a bit more sense. 

For instance, \$d_1s_1\$ is the power contribution from \$s_1\$ if the waveform that produced \$s_1\$ (\$u_1\$, via the integral) was present for the whole of the period from 0 to T.

Ditto all the other contributors.

For this waveform: -



If you put numbers down like \$d_1\$ = \$d_2\$ i.e. 50% duty cycle with T=1, \$I_2\$=5 and \$I_1\$=1, the RMS calculated by the equation in the question would produce this: -

\$\sqrt{\frac{25}{2}+\frac{1}{2}}\$ = \$\sqrt{13}\$

Then if you compared this with the more conventional approach of assuming it was a symetrical square wave with peak values of +2 and -2 (superimposed on a DC level of 3) you would get: -

\$\sqrt{2^2+3^2}\$ = \$\sqrt{13}\$