It sounds as though you need to check this out with your doctor. Has this ever been a problem for you in the past? Are you in high-stress work environment? Do you indulge in over-consumption of alcohol?
Assuming you're in good health (verify this w/ a medical checkup), it's especially important in prevention of ED is to not over-indulge in alcohol, or certain drugs. Also, having a proper night's rest helps immensely. High stress, anxiety and chronic distress can interfere, too.
Furthermore, check the health statistics 'cause it's not uncommon, though a bit less so for younger men. These things are public knowledge. Just query it on Google.