By longstanding convention, when a question is identified as a duplicate, the one asked earlier tends to be considered the "original" and the one posted later the "dupe".
However, this is only convention, not a hard and fast rule. Many factors can influence the choice of order, and there are as many ways to weight and order the factors as there are close voters.
One commonly used factor is quality. Generally, people want to close poorly written questions as duplicates of better-written questions.
Closely related to the above is answer status. A question that has been answered tends to make a better "master record" than one without answers, and more comprehensive answers trump short or incomplete ones.
Another thing that comes into play in some cases is existing closure status. If the duplicate that has been found is, itself, closed, many people seem to be reluctant to choose it as a "master". If someone thinks C is a duplicate of B, but B is itself closed as a duplicate of A, the voter will in many cases vote to close C as a duplicate of A, skipping B entirely.
With all that being said, it's hard to precisely identify what rationale was used for any given individual case. Since closures generally require five agreeing votes, there may even be competing perspectives, with the "winner" being whichever post happens to command a majority (or the tiebreaker, time of vote) when the fifth vote comes in.
In your case, who's to say that the people who upvoted the other post didn't also upvote yours? (Okay, people with access to the votes database table, I guess.) Unfortunately, there are as many ways to define fairness in voting as there are to define the right way to close as duplicate. At the end of the day—and I know this is easier to say than to do—I guess be happy that you got your question answered, which is the whole reason you were here in the first place?