In Denmark, a large part of the electricity is produced by wind turbines and combined heat and power plants (CHPs). Most of them are connected to the network through distribution systems. This paper presents a new algorithm for allocation of the losses in a distribution system with distributed generation. The algorithm is based on a reduced impedance matrix of the network and current injections from loads and production units. With the algorithm, the effect of the covariance between production and consumption can be evaluated. To verify the theoretical results, a model of the distribution system in Brønderslev in Northern Jutland, including measurement data, has been studied.