Capital gains taxes and in kind purchase offset

Is it possible to incur capital gains and then separately sell products at a loss with the result being a reduction in capital gains taxes?