Table with conditional filter in the dimension

I am using these commands as a dimension to filter my database according to the columns 'Sides' and 'Name0.value'. It worked perfectly in the count chart, but in the names table, I receive an error "Aggregations and metric expressions are not allowed in this expression."

CASE
WHEN COUNT(DISTINCT CASE WHEN Sides IN ('left', 'both') THEN Name0.value ELSE NULL END) >
COUNT(DISTINCT CASE WHEN Sides IN ('right', 'both') THEN Name0.value ELSE NULL END)
THEN COUNT(DISTINCT CASE WHEN Sides IN ('left', 'both') THEN Name0.value ELSE NULL END)
WHEN COUNT(DISTINCT CASE WHEN Sides IN ('right', 'both') THEN Name0.value ELSE NULL END) >
COUNT(DISTINCT CASE WHEN Sides IN ('left', 'both') THEN Name0.value ELSE NULL END)
THEN COUNT(DISTINCT CASE WHEN Sides IN ('right', 'both') THEN Name0.value ELSE NULL END)
ELSE COUNT(DISTINCT CASE WHEN Sides IN ('right', 'both') THEN Name0.value ELSE NULL END)
END

How can I solve this problem?

0 1 154
1 REPLY 1

That expression will be considered as a metric because of its aggregation, which means you can't create it as a dimension. 

But, you should still be able to create a filter on a metric. Do the steps in this article work for you? https://support.google.com/looker-studio/answer/7326859?