Trade 1: Consider you buy 30 shares of XYZ at Rs.100 each. The stock moves up to Rs.105 and you close the position, thus booking a profit of Rs.150.
Trade 2: Now the stock moves down to Rs.102. You buy 40 quantity of XYZ shares again.
Buy average of both trades: (30x100)+(40x102)/70 = 101.14
Now, consider the price of the stock moves further down to Rs.100 (which is less than the buy average) but the positions P/L will also consider the profit that you already made during the first trade, i.e.
Positions P/L for XYZ = Profit made in Trade1 - Loss made in Trade 2
= 150 - (40x2)
= 70
Hence, the profit or loss appearing in positions is considering the all trades made in that stock during the day.