Step 1: Read your consumption units in terms of kWh from Bi-directional Meter (note: both reading have to consider "Export" & "Import")
Step 2: For example you have 100 kWh (units) as consumed /Import and 300 kWh (Export) /Sell then your bill should be = Consume Units (Import) - Sell Units (Export), 100 - 300 = (-200) Units
Step 3: Now -200 Units will be consider as Credit Energy in account of consumer. (negative sign indicated balance/credit Units)
Step 4: Find out energy costing at your DISCOM provider, also find unit rate as per location, rural, urban, etc.
Step 5: Charges may in slab wise in many states. for example,
first 50 Units - 2.5 Rs/Unit
second 100 Units - 3.5 Rs/Unit
third 200 Units - 4 Rs/unit
This slab depend on state and their rates by electricity provider.
Step 6: If you have credit energy in your account (-200) then it will be give you 200 x 2.5 Rs (standard price for export energy) = 500 Rs. (earning)
If you have Consume energy 100 Units then you must follow slab wise multiplication first 50 units x 2.5Rs = 125 Rs, then second slab rate 50 x 3.5 Rs = 175 Rs. Total is 175 + 125 = 300 Rs. Payable
Step 7: Don't forgot to add fix meter charges + Fuel energy charges in case of consume units.
Calculation is Depend on State policy and different rates.
Video Link: https://youtu.be/axxMhzJRPEM