Level 11

@j-kanabis  "Now if the capital gain from stock sales ($ 15,000) was used towards it that would be considered a distribution. "

If $30,000 was distributed for the benefit of a beneficiary, that is the maximum DNI that would show on the Schedule K-1.  But whether the trust pays tax on the capital gain, or it flows through to the beneficiary, is determined by the trust document, or in the absence of such a provision, by state law.  Usually, capital gains are taxed to the trust, even if funds were distributed to a beneficiary.  The funds are considered to have come first from trust income (not capital gains) and then from trust principal (which includes the capital gains, after taxes).   

The $30,000 received by the beneficiary is a deductible medical expense, if all other requirements are met.  It doesn't matter whether all of it, some of it or none of it is shown as income on the K-1.