There's no dayofweek function in SQL, you probably run this query from SQL Assistant using ODBC and the ODBC driver replaced it with valid Teradata SQL, but this is not done in Derived Tables or View definitions.
I never liked this and usually disable it by checking "Disable Parsing" in the ODBC driver options (or uncheck "Allow usage of ODBC QL extensions in queries" in SQLA->Options->Query in older SQLA versions).
But you got luck, in 13.10 there's a day_of_week function which returns the same value, it was renamed to td_day_of_week in 14 or 14.10.
There's no dayofweek function in SQL, you probably run this query from SQL Assistant using ODBC and the ODBC driver replaced it with valid Teradata SQL, but this is not done in Derived Tables or View definitions.
I never liked this and usually disable it by checking "Disable Parsing" in the ODBC driver options (or uncheck "Allow usage of ODBC QL extensions in queries" in SQLA->Options->Query in older SQLA versions).
But you got luck, in 13.10 there's a day_of_week function which returns the same value, it was renamed to td_day_of_week in 14 or 14.10.