This is really just to expand on Bob Baerker's answer and clarify the before language and where that might apply.
Consider these transactions:
Day 1: Buy 100 Shares XYZ for $1,000
Day 20: Buy 50 Shares of XYZ for $700
Day 20: Sell 50 Shares of XYZ for $400
The day 20 sale results in a loss.
Either way, this loss is washed because within 30 days of the transaction that resulted in a loss you opened a position in a substantially similar security. Depending on the accounting you're using, usually FIFO (first in first out), you would have sold 50 of the Day 1 shares or all of the Day 20 shares.
After the sale you're now holding, for simplicity lets just use FIFO.
Day 1: 50 Shares of XYZ which cost you $500
Day 20: 50 Shares of XYZ which cost you $700
Disallowed loss of $100
The disallowed loss needs to be applied to either the shares in the Day 1 or Day 4 transactions.
So from a tax standpoint you're holding:
Day 1: 50 Shares of XYZ which cost you $600
Day 20: 50 Shares of XYZ which cost you $700
If on Day 50 you sell 50 more shares of XYZ and there is a loss, your loss would be washed by the Day 20 buy.