In signal processing, the energy of a discrete signal x[n] is Σ|x[n]|² from n=0 to N-1, where N is the number of samples. This computes the energy in the time domain.
Now, Parseval’s theorem states that the sum of the square of a function equals the sum of the square of its transform. Thus, you can calculate the energy in the frequency domain using this theorem. The energy of the signal equals (1/N)*Σ|X[k]|² from k=0 to N-1, where X[k] is the discrete Fourier transform of x[n].