If you really mean power ((k)W, not (k)Wh) this is hard to get right. Unless you actually measure it (which in many installations might even be impossible depending on how things are connected) you can only calculate it.
But the trouble is, the values you get from solar and your energy meter are samples that are often not very frequent, not at the same time, and fluctuating. So when you start adding and subtracting samples from different points in time, the result may at times be weird.
The power flow card in HACS can do many of the calculations for you. It is quite nice to have, and usable if you know values are not exact and can even be impossible at times during fluctuations.