couple of things;
-units can not have more than 2 formations (nor less than 1, obviously)
-square-formation needs to be 1 of the 2 ...

now I'm not sure if phalanx can replace square (imo phalanx is crap so I havent worked much with it ..) but if thats not the case you simply can not have "phalanx + shieldwall" units .. its "square + phalanx" or "square + shieldwall"


ps; small correction to the above, square can be replaced ... by "horde" ...
so you could, for instance, make "horde + phalanx" units ...


G