I have created a Warehouse, and divided the Warehouse into 2 subinventories.
Now the problem is, the same item is having unique Average Costs in each Subinventory. Ideally, for the whole warehouse, there should only be one common average cost.
Okay, you are saying you added a Group in the Warehouse tree. And under the tree you added two Warehouses. I think ERPNext treats these two “subinventories” as separate warehouses and will calculate the valuation of the items in each warehouse separately.
I know this doesn’t help, but the way you’ve implemented this, ERPNext is not designed to support the outcomes you need.