A molecular compass-like behaviour is found in a perovskite-type cage compound (HIm)2[KCo(CN)6] (HIm = imidazolium cation). The dynamic changes in the HIm cation from the static to rotating state along with the rearrangement of the host cage result in switchable and anisotropic dielectric constants.