Should be pretty straightforward. When combining multiple formations into a single formation, or number assigned to troops (infantry, archers, etc.) all units are no longer under your command and just default to either charging or just standing in whatever formation they were in last. Toying around with it I can rarely get all units to combine into a single formation. It only happens in Hideouts. I have yet to find a consistent fix to this in game.