Tax Year Prior to 2020: QBI Deduction

Hello,

I have a consulting business that does not qualify for the QBI deduction unless we meet the $315k income threshold.  My consulting business produces income less than this amount.  What I would like some input on is does investment income and/or capital gains get added to your income threshold as I sold a second home and had a rather large capital gain that in combination with my consulting income would put me over the threshold.  Thanks for your help.