A theoeritical study on the effect of a magnetic field or impurities on the carries states of self-assembled quantum dots is presented. The magnetic field is applied along the growth direction of the dots, and for comparison two systems are considered, InAs embeded in GaAs, and GaN in AlN. The electronic states and energy are calculated in the framework of the k.p theory in 8 bands including the strain and piezoelectric effects. Zeeman splitting and anticrossings are observed in InAs/GaAs, while the field introduces small changes in the nitrides. It is also included a study about hidrogen-like impurities, which may be negative or positive. It is noted that depending on the type of impurity, the confinement energy of carriers is changed, and the distribution of the probability density of the carriers is affected too.