If charging can only be achieved in a specific position - or if charging is interrupted if the iPad, cable or Power Adapter are disturbed - this usually indicates an intermittent electrical connection.
The first step in diagnosing the issue is to systematically substitute the Power Adapter and charging cable for another known-good item. If the problem is resolved, you have located the issue.
If substituting the Power Adapter and charging cable does not resolve the issue, then the problem lies with the iPad - either an internal fault or the charging connector itself has an issue. In both cases, your iPad will require assessment and potential repair by Apple.
You would be best advised to visit the Genius Bar at your local Apple Store or Apple Authorised Service Provider (AASP) where the technicians will be able to test your iPad, Power Adapter and cable(s) - and you can explore your available options for repair:
Genius Bar Reservation and Apple Support Options - Apple