Every attempt goes into the denominator, completed or not.
It's a better measure than yards per reception because it takes into account incompletions. Someone could have 10 yards per completion but only complete 40%, which is lousy. If you're completing 58% and averaging 8 yards on every pass attempt, you have a pretty efficient passing game--not elite, but very good.