What's the error? Reading the error message might be a good place to start. It might actually tell you what it thinks the problem is in an understandable message.
Some things to check would be the object references. Make sure you have not left in references to things you don't want and that the object references are correct (no missing . or ] for example).
Other things to check would be the syntactic completeness of any functions used.
Filters are not too difficult to write, provided you understand what is being sought.
Macro syntax can be tricky, especially if used in a different context from what is appropriate.
In general, a filter expression which uses macros will have syntax similar to this, where a session parameter is being feed to a parameter map:
[gosales].[Sales staff].[Staff name] = #$UserLookUpMap{$UserId}#
This is a simpler type of macro in a filter.
Product_lang = #sq($languageCode)#
Here's a link to a help topic on the question.
https://www.ibm.com/support/knowledgecenter/en/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ug_fm.doc/c_using_macro.html#using_macro
Contrary to some opinions in other threads, any syntactically correct expression, using any syntactically correct function, including
in then else, is valid for a filter as long as the results of the filter resolve to a Boolean. This is necessary as the filter is added to the WHERE clause of the SQL statement.