Support to variables used in time intelligence functions

The dates expression used in time intelligence functions can be a variable name, which has the same syntax of a table name.