Battery turned into X after Yosemite After I installed Yosemite on my MacBook Air, the battery icon is just an X.

I have tried restarting the computer, and turning off the computer, then back on, but nothing is happening! Even the charger won't recognize that it is plugged in. This Mac is less than two years old, the battery should be fine.
There is a circuit board on the battery itself that reports its presence and status to the OS X.

In OS X, there is a piece of hardware run by firmware called System Management Controller (SMC) that takes that information and processes it. Sometimes, the SMC gets confused and needs to be reset following instructions from Apple.

You can also look up your Battery information in the About This Mac, to see what it says.

What could cause the display of the X?

The circuit mounted on the battery itself could have malfunctioned. Normally, it will reserve a minimum charge for itself and not allow the battery to drain beyond that point. But, if the battery was drained to the levels that the built-in circuit can no longer function, it will not report the status and ask to be charged. If you were installing Yosemite, you should have gotten a warning that you are on battery. If ignored, the battery could have been drained completely. 

So what can you do other than SMC reset or bringing it in for repair? You can try the coconut app to see if it does something. https://www.coconut-flavour.com/coconutbattery/