Thanks that's the solution.
One more question how can I filter by a column name dynamically?
def by_filter_attribute(query, filter, filter_values) do
from [m, a, mu, p, bf, l] in query,
where: fragment("?.?_id in (?)", ^a, ^filter, ^filter_values)
I'm trying everything and nothing seems to work.