After filling the entire table, where's your answer? You want the maximum value using all items with capacity at most . That's W. because of how the transition works, already contains this maximum.
Each state considers "capacity " as "up to ", not "exactly ". So is your final answer. Understanding this concept will help you solve more complex problems.