Phrase "beat the purpose"

Would it be correct to say -

“Why are you heating ice-cream on the stove. It beats the whole idea/purpose of serving cold.”

The phrase is ‘defeat the purpose’. This means it is counterproductive or it is not directed toward the stated goal.

Thanks :slight_smile: