It is needed in some countries to put the beer energy content on the label. This page offers two ways of calculating the beer energy content: a simplified method based on original gravity and a detailed method based on the main constituents of the beer.
Beer contains alcohol, residual sugars, and proteins that all have an impact on the total energy content.
Simple method by approximation
This is just based on the value of the original gravity assuming a constant average ratio of the different constituents.
It is needed to know the exact amount of the different constituents with this method.