I didn’t understand what you want to do. Do you want to create several models and each one of them will have this macro with a different filter?
If so, and your model is just a select star with a single filter, I would rather use the SQL code in the models, as it makes them more readable, and you don’t need to worry about vars.
But it is a personal preference, if you want do it your way, you can do it like this:
Your macro is ok.
In your model, you should call the macro this way:
{{ model_with_filter(var('factor_sql_filter')) }}
And you can either put the var in your dbt_project.yml
vars:
factor_sql_filter: "service_type in ('INTEREST_FEE', 'COMMISSION_FEE', 'LATE_FEE') and type != 'CREDIT_MEMO'"
or in the CLI like
dbt run -s my_model --vars "factor_sql_filter: service_type in ('INTEREST_FEE', 'COMMISSION_FEE', 'LATE_FEE') and type != 'CREDIT_MEMO"