If X and Y are normally distributed, you can use a Pearson correlation.
If they are not, you can use a Spearman rank correlation.
Here is some R code.
> a <- c(1,2,3,4,5,6,7)
> b <- c(2,4,6,8,10,12,14)
> c <- c(2,5,4,10,8,13,11)
> d <- c(7,6,5,4,3,2,1)
> e <- runif(7, min=1,max=14)
> e
[1] 6.938054 1.347591 1.561456 10.867986
[5] 1.044163 1.870397 12.238245
>
> cor(a,b, method="spearman")
[1] 1
> cor(a,c, method="spearman")
[1] 0.8928571
> cor(a,d, method="spearman")
[1] -1
> cor(a,e, method="spearman")
[1] 0.2857143
>
A perfect correlation has a value of 1. A perfect negative correlation has a value of -1. 0 means there is no correlation. the runif() command generates random data. The c() command creates a vector. The data could also be put in tables, with rows and columns.
This page described what I did here more fully: http://www.sthda.com/english/wiki/correlation-test-between-two-variables-in-r