What database is this? If it's something like MSSQL, you can't use aliases like that elsewhere in a query. You'll have to replicate the whole alias definition:
SELECT big+ugly+calculation AS foo
...
HAVING (big+ugly_calculation) = bar
Or wrap the query in another:
SELECT *
FROM ( SELECT *, big+ugly+calculation AS foo )
WHERE foo = bar