Charge Density Waves, Superconductivity and Magnetism are all intriguing materials phenomenon separately, but even more so in systems where two or more of them compete. Some-times the relevant parameter that determines which final state emerges is unmeasurable directly, but can be calculated. Using density functional theory methods, I will show how structure and electronic structure are linked and specifically, how the band structure and fermiology drive phase transitions in layered materials. Specifically, I will discuss dichalcogenide systems where superconductivity and CDW states compete and can be manipulated via pressure. I will also discuss the recently discovered Fe-based superconductors in which magnetism and superconductivity compete. Finally, I will discuss a set of phosphate olivine materials in which the electronic structure gives rise to magnetic order that couples to a structural distortion that controls conductivity.