Most Elite x2 keyboards offer dual connectivity (USB-C dongle and Bluetooth). If the keyboard fails to type via the dongle but works via Bluetooth, the internal radio or the port is the culprit, not the keys themselves.
Turn off the tablet. Use a pencil eraser to gently rub the gold contact points on the back of the keyboard and the bottom edge of the tablet. Follow up with 91% isopropyl alcohol on a cotton swab. Do not use water. hp elite x2 keyboard repair
Use compressed air monthly to blow out debris from under the keys. Most Elite x2 keyboards offer dual connectivity (USB-C