cant do factory reset or hard reset on mi 5x
Reading the comments above, I can think  your volume up button may be broken? But remember, you can perform  a factory reset from the Fastboot mode too, simply connect your phone to the computer, install Minimal ADB &amp; Fastboot (Windows), run it then type fastboot -w[press enter] the phone should be reset. 

Also ADB lets you do many things on your phone including factory reset: 


Enable ADB (USB Debugging) from the Developer's menu
Connect the phone to the computer
Run Minimal ADB &amp; Fastboot
Type adb shell [press enter]
Type wipe data [press enter] 


You're done. 

ADB can let you boot in recovery mode and perform factory reset manually: 


Type adb reboot recovery [press enter]


PS: Don't forget to install drivers to let your phone be detected by the computer. 

Not on Windows ? Check this question related to a minimal installation of ADB for all operating systems.

Check also our ADB tag-wiki