Electronic structure calculations frequently invoke the supercell approximation and solve for electrostatic potentials within periodic boundary conditions. For systems that are electronically charged, or contain dipole (or higher) moments, this artifice introduces spurious potentials due to interactions between the system and multipole moments of its periodic images in aperiodic directions. I describe a method to handle properly the multipole moments of the electron density in electronic structure calculations using supercells. The density is divided into two pieces. A model local density is constructed to match multipole moments of the full density. The potential from this piece is obtained treating this density as isolated. With the density of this local-moment countercharge removed from the full density, the remainder density no longer contains moments with long-range potentials, and its electrostatic potential can be evaluated accurately using periodic boundary conditions.