

When I put in a column name into the operator, the editor returns an 'Unknown Field' error.
Metabase custom expression not null how to#
cross apply is fine with smaller datasets but may not scale well. I'm trying to set up a CountIfexpression, and I can't figure out how to set the query to find when a column value exists. Īlso note that you may need to beware of performance. If you're using MySQL, you'd probably want to take an approach like. , TRIM(TRANSLATE(b.item, '" ', ' ')) as item Assuming your string values do not contain any of the markup characters (including embedded spaces), the following should work: with a as (
Metabase custom expression not null update#
Or you could modify the tvfSplitToTableStrings function itself to parse and strip unneeded markup more intelligently. Update metabase to 0.38. Since your strings seem to contain extra markup, you can clean this up using TRANSLATE(). In our case, the first thing we want to visualise are the sum of impressions. Next, say we want to visualise some important metrics.

These steps can be visualised in the graphic below. Select 2 as id, 'snake,cat,racoon' as animalĬross apply app.tvfSplitToTableStrings(a.animal, ',') b Example question in Metabase (step-by-step) Start by clicking Ask a question > Simple question > Pick the data you want to work with > View the raw data. SET = can then use it with cross apply as follows: with a as ( remove the word we just added to the table SET = get the first word (from the left) less the delimiter character if there are no delimiters, then this is the only item in our list SET = loop while all the characters in the list have not been traversed yet You can check out a full list of expressions in Metabase, or walk through a tutorial that shows you how you can use custom expressions in the notebook editor. SET = get index where our delimiter was found From the documentation, Athena may do it simpler. The expression contains ( comment, 'Metabase') would. Typically, this would need an UNPIVOTING of your columns to rows and then check where not null and then back to PIVOT. When using the query builder, you can use expressions to create new: Filters. Something like this can get you started:Įdit: Oops! Newer SQL Server has the string_split() function which you can similarly cross apply, eliminating the need for tvfSplitToTableStrings(). To use custom expression, create a Custom Column (where the custom expression is used as a Field Formula to calculate values for the new column), or click on Filter or Summarize and select Custom Expression. What version of SQL are you using? If using SQL Server (T-SQL), one approach is to split your concatenated text field into pieces using a table-valued function.
