Did you install something magnetic within a few feet of the compass? Common items that are magnetic include speakers and
steel cookware. There may be other magnetic items so look around for anything that could act as a magnet.
Next, turn off all
power in the
boat. Literally everything, including AC
shore power and all DC at the
batteries even
battery operated stuff.
If the compass is still off by the same amount then it probably needs to be "adjusted". You didn't give the model of the compass but most "big fluid" compasses have compensation magnets that are used to "compensate" the compass so it points north no matter which way the
boat is pointed. The adjustment of these is somewhat complicated. So much so that there are people that adjust compasses for a living.
If turning off all
power in the boat allows the compass to swing back then you know it is
electrical. DC
current is what makes a compass swing away from north.