For P(X) you are looking at the distribution only for X. Basically for P(X = x) you need to consider that this probability relates to P(X = x|Y = 1) + P(X = x|Y = 2) + P(X = x| Y = 3) + P(X = x| Y = 4) if you are only looking at P(X = x) since you are now looking at a less general distribution that only considers the value of X and not of Y and so you need to collect all the probabilities that have x as your common factor: you can think of this as "slicing".
As for P(Y|X) you should think about this in terms of P(Y=y|X=x) which means that you know your value of x and what to get the probability for the "slice" of X given that value.
Mathematically, P(Y=y|X=x) = P(X=x,Y=y)/P(X=x) so what you are actually doing is looking at only the slice for X=x and then looking for the ratio of the probability for a particular y in the context of all probabilities where X = x.
For P(X=3|Y) you are looking at a specific distribution where X=3 in the Y slice and this means you need to consider all possibilities of Y if you haven't been given one. This means that this probability distribution asks you to consider P(X=3|Y=1), P(X=3|Y=2), P(X=3|Y=3), and P(X=3|Y=4) and all of these values will form your distribution for this random variable.