Deductions & credits

Can you comment as to if this deduction would apply to the LLC A only which only made $2k profit this year or could it also be applied to my K-1 or general stock gains?

 

For example, if I make $20k profit in stock gains, $10k k1 and $2k for the LLC A (the car is for this business) can I use the $26,000 limit toward the $20k stock profit OR the $10k K-1 income?

 

If it only goes towards the $2k profit on the LLC A then there will be negative gains?