iMac random shutdown I have recently faced a critical issue with my iMac (since June 2016). The problem showed up after installing OSX El Capitan. It shutdown randomly and suddenly. It's as if the power cord has been disconnected. And it doesn't restart when I press the power on button. I have to switch off the power socket, wait for a few minutes, then it can be turned back on. 

After 3 visits to Apple Store to fix this, they ran same test to see if it's a hardware- or softwareproblem (negative), the ram-module is replaced, they have done a clean install and it's still the same problem.

Is there anyone who has a solution for this problem?

to be continued...
I can't imagine the Apple Store haven't already done this - but have you/they tried resetting the SMC?

For iMacs, the steps to do this are:


Shut down your computer
Unplug it from the power socket 
Press and hold the power button for 5 seconds
Plug it back in and turn it on.


However, assuming they have already tried this, there are other things they can do, such as swapping over the logic board.

Troubleshooting is a process of elimination, and you know that reinstalling macOS doesn't resolve the issue, and neither does replacing the RAM. So, if it was me, the logic board would be next.

Let us know how you go.