The Bragg peak position of a homogeneous solid solution epitaxial film is directly related to the solid solution concentration, film strain and, consequently, residual stress. The peak shape contains information about defects present in the sample. In the case of compositionally graded epitaxial films the situation is more complex since instead of a single Bragg peak there is a continuous diffracted intensity distribution which can be measured by means of recording high resolution reciprocal space maps. We analyse the thin film residual stress based not only on peak positions, but taking into account the defect-induced peak shape as well. Consideration of the peak shape enables the determination of the stress depth profile in the case of graded films and to improves the accuracy in the case of homogeneous films.