Get my self consumption calculated

Hi.
Want to make a sensor that shows my self consumption of solar produced electricity.
I have a sensor for produced, “inverter_daily_yeild” and a sensor for sold electricity, “P1_meter_total_sold”

How do i get a sensor of this that shows self consumed electricity? Thanks