Custom Expressions with Strings

Hi, really enjoying using Metabase

A little stuck with how to do a custom expression.

I basically want to do = Average(“Field”) and (“String” == “bla”)

What I am trying to do is compare the overall average across my data verses my own actual companies average.
I already have the overall average displayed

So you have like one big table that has all the data you care about, and you want to see the total average of field X, but also the average of field X where company_name IS My Company? And I’m assuming you’re doing this with the query builder and not in SQL, right?

The way you’d have to do this is to create two separate saved questions: one of them that has the overall average, and another one that has your company’s average. This is because any filters you apply to your question apply to all expressions/aggregations in the question; so even though you can have multiple expressions in your question, the problem is that you’re wanting one that’s filtered, and another that isn’t.

So after you create your two saved questions, you can combine them on a dashboard card. Create a dashboard, add the first saved question, and then hover over the card and use the +Add button to select your second question and combine it with the first one.

Let me know if this helps.

1 Like

Thank you this solved my issue