As you have found out, you cannot use any sort of function or comparison other than = in a Where clause in a Variable. There is a FAQ entry that discusses one possible solution.
There are also a number of different examples of variable “where” clauses in some of the presentations that I’ve done over the years… you can download them all here: