I'm a bit confused by your question. I'm used to people asking how long they can be in a country before having to pay tax there, not how long can they be away before impacting their taxes. But I'll take the question at face value...
While I'm not a tax expert, I have lived outside the US and filed my own taxes for years. I believe your question really boils down to whether you're considered resident or non-resident in the US during the tax year. You can find more by looking at the IRS pages definining these terms and the policies that apply to each.
On https://www.irs.gov/individuals/international-taxpayers/resident-aliens, the IRS says:
If you are a resident alien, the rules for filing income, estate, and gift tax returns and paying estimated tax are generally the same whether you are in the United States or abroad. Your worldwide income is subject to U.S. income tax the same way as an U.S. citizen. You are a resident alien of the United States for tax purposes if you meet either the green card test or the substantial present test for the calendar year.
Given you aren't a permanent resident of the US, the "green card test" doesn't apply to you for determining your US taxation. Instead, the "Substantial Presence Test" does. (see https://www.irs.gov/individuals/international-taxpayers/substantial-presence-test). Basically, under your described plan, you'd qualify for regular US taxation because you'll be in the US for at least 183 days of the current tax year. (Note the cases for "exempt individuals" on that page -- I presume these don't apply to you.)
If you somehow do qualify as non-resident (assuming info you haven't provided in your question), here's a link to the main IRS page covering non-resident alien taxation in the US: https://www.irs.gov/individuals/international-taxpayers/nonresident-aliens
Oh, and by the way, if you are instead asking as to whether you get any sort of deductions on your US taxes for income earned while visiting/living in Brazil, the answer is yes. And there is no time limit or minimum on this that I'm aware of, though it might not be worthwhile to do all the paperwork if you haven't spent enough time outside the country. There are ample sources to search for information on "foreign earned income exclusion" and "foreign tax credit"