The trick to referencing variables in Keyboard Maestro is to be aware of what kind of text field you're working in at any given time. Variable and Calculation fields generally expect variable names to be written as-is (in your example, just X and Y), whereas in text token fields, variable names must be written like %Variable%[VARIABLE NAME]% (so in your example, %Variable%X% and %Variable%Y%). Fortunately, KM8 (which I can tell you're using from your screenshot) makes this much easier by displaying a small V, C, or T at the right side of the current text field to indicate which kind of field you're working in (you can see this in action in your screenshot, which shows a V at the right side of the current text field, Set Variable Y).
In an If Then Else action, if you click in the is = field (the one that says "value" in your screenshot) you will see a small C on the right side of the field, indicating that If…then statements are calculation fields, and thus expect "plain" variable names. Therefore, to see if variable X is equal, lesser than, etc. to variable Y, you would type Y in the appropriate field:
As you said: obvious when you know how, but definitely not obvious when you don't
Hopefully it's a bit clearer now!
On a different note, if I may offer a suggestion based on your stated desire to test two variables for multiple conditions (i.e. equals, greater than, less than, etc.) I would recommend looking into using a Switch/Case action instead of an If Then Else action, as it makes testing multiple conditions against the same data much easier. Example:
Feel free to post again if you have any more questions!
@gglick covered most of this, but I thought I'd add some screenshots for additional clarity.
In order to perform calculations, you must either be in an Action Calculation field or use the Calculate token (KM Wiki).
So, how do you know when the input area for an Action is a "Calculation" field, vs. a "Text" field?
Well, when you click in the input area you will see a small indicator in the far right of the field that will be one of the following:
like this:
Action with Text Field
This field expects everything you enter to be explicit text, unless you encode it with the % delimiters, indicating a Token (KM Wiki) of some type.
To perform calculations here, you must use the Calculate token (KM Wiki).
This field expects the actual Variable Name, OR, in some cases, a Variable Token that will evaluate to another Variable Name
If this all seems a bit confusing, then be assured this is often confusing to new KM users, but will soon feel like second nature, or muscle memory, after you have built a few macros.