The existing four-division management method for line loss in smart grids has problems such as the inability to verify line loss contemporaneity and low application flexibility. Considering that the rich data resources provided by data acquisition devices such as measurement meters in the smart grid are not fully utilized, an arbitrary partitioning line loss calculation method that fully utilizes measurement data resources is proposed. The method classifies the grid nodes according to the type of measurement data, obtains complete line power data, and then formulates the boundary equivalence principle of grid partition to realize arbitrary region partition of the power network. On the basis of network partition, the power loss of each subnetwork is calculated by using the power flow of matpower, which greatly increases the flexibility of smart grids line loss management. Taking a power grid in a certain area of Gansu as a case study, the effectiveness of the calculation method is verified.