Problems in the bedroom

My partner cannot get hard before sex 
​I don't understand
​What can I do?
​Apart from the obvious things which I have tried
​He just goes from in the sexual mood and then straight out of it 
​We still have sex but it is often difficult as this happens.