Hi. This sounds much like a battery problem. What tablet model do you have? At what stage does it switch off. You can first try clearing cache, if the issue persist, then try to 'Wipe data/factory reset'. Let us know what model and brand name you have and we should be able to assist with clearing cache from recovery mode.