Position conversion from intraday to cnc

Hi
I bought MIS trade 1500 shares , @17.10 InR and sold @17.5 inr , 1000 shares and @17.9 inr ,500 shares earning 725 InR in process. Then again I bought intraday @ 18.15 ,1500 shares and converted my position to CNC before market closing. Zerodha system is showing me a loss of -25 InR on MIS trade and profit of 350 InR in CNC position and averaging my buy price of CNC at 17.65 InR though I converted my position at 18.15 InR( since I bought at this price 2nd time). I am not getting it properly how this method works. Why it is showing me a average price when both of my trades are distinct and separate. Why is CNC and Mis trade averaging takes place?