How to calculate FIFO method of stocks?

I buy 15 shares at 180₹ rate 1year ago
So 15180= 2700
.
Then market falls in march and i buy more 20 shares at 64.5₹ price
So 20
64.5=1290
.
Therefore total investment is
2700+1290= 3990₹ at the avg price of 114₹.
.
.
Then i sell 25 shares at 106₹ price
So 25*106= 2650₹
.
So the remaining 10 shares price must be
3990-2650= 1340₹ (i.e 134 avg price)
.
But insted of 1340 in my demat its showing 859.1₹ at the avg price is 85.91
.
How this has been calculated the 85.91 price?

When you sold 25 shares, 15 will be from those that you bought a year ago and the remaining 10 from those you bought later.

You will have 10 shares remaining from those that you bought at 64.5, so your value for remaining shares will be 10 * 64.5 = 645 and average price 64.5.

Ideally, this is how it should be, but something doesn’t add up.

You can go to Console > Holdings and see the breakdown for this stock and do the calculation yourself.

For further support, you can raise ticket at support.zerodha.com