Surface roughness of planar samples causes an additional attenuation of X-ray diffraction intensity measured in Bragg–Brentano geometry. The decrease of intensity becomes stronger with decreasing scattering angle. This is part of the microabsorption effect. Two quantitative expressions describing the microabsorption effect are incorporated into the DBWS 9006-PC Rietveid program [D. B. Wiles and R. A. Young, J. Appl. Crystallogr. 15, 149–151 (1981)]. The procedure is applied to scattering data obtained from YBa2Cu3O7-powder samples with different degree of surface roughness but approximately identical bulk structure. The procedure is proved to work well. However, the values obtained for the parameters of the temperature factors and the microabsorption effect are correlated, and careful discussion is necessary to interpret the results.