Capacitive deionization (CDI) is a desalination technique that can be applied for the separation of target ions from water streams. For instance, mono- and divalent cation selectivities were studied by other research groups in the context of water softening. Another focus is on removing Na+ from recirculated irrigation water (IW) in greenhouses, aiming to maintain nutrients. This is important as an excess of Na+ has toxic effects on plant growth by decreasing the uptake of other nutrients. In this study, we investigated the selective separation of sodium (Na+) and magnesium (Mg2+) in MCDI using a polyelectrolyte multilayer (PEM) on a standard grade cation-exchange membrane (Neosepta, CMX). Alternating layers of poly(allylamine hydrochloride) (PAH) and poly(styrene sulfonate) (PSS) were coated on a CMX membrane (CMX-PEM) using the layer-by-layer (LbL) technique. The layer formation was examined with X-ray photoelectron spectroscopy (XPS) and static water contact angle measurements (SWA) for each layer. For each membrane, i.e., the CMX-PEM membrane, CMX membrane, and for a special-grade cation-exchange membrane (Neosepta, CIMS), the Na+/Mg2+ selectivity was investigated by performing MCDI experiments, and selectivity values of 2.8 ± 0.2, 0.5 ± 0.04, and 0.4 ± 0.1 were found, respectively, over up to 40 cycles. These selectivity values indicate flexible switching from a Mg2+-selective membrane to a Na+-selective membrane by straightforward modification with a PEM. We anticipate that our modular functionalization method may facilitate the further development of ion-selective membranes and electrodes.