---
title: "Deploy Metabase Field Filters"
description: "SQL template tags and dashboard field filters"
category: "Analytics"
url: https://railway.com/deploy/deploy-metabase-sql-field-filters
---

# Deploy Metabase Field Filters

SQL template tags and dashboard field filters

**[Deploy Metabase Field Filters on Railway](https://railway.com/template/deploy-metabase-sql-field-filters)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-metabase-sql-field-filters/manifest.json

- **Creator:** onepush
- **Category:** Analytics

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### metabase/metabase

- **Image:** metabase/metabase
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Metabase Field Filters (Open-Source BI) on Railway

This template deploys Metabase Field Filters on Railway with a Postgres app DB. It's for analysts who need parameterized SQL questions and dashboard filters without per-user fees. Use the official metabase image on port 3000, env vars set for production.

## About Hosting Metabase Field Filters open-source software on Railway (self hosted Metabase template)

Hosting Metabase Field Filters on Railway gives you a single-node Metabase instance (official `metabase/metabase` image) plus a Railway Postgres 18 service that holds the application database, not your analytics data. Railway handles deploys, TLS, and restarts; you handle the SQL and field filters.

## Why Deploy Metabase Field Filters, the Tableau alternative on Railway (Railway Free Trial)

Tableau charges steep per-user fees before you can test a field filter; on Railway you pay only for compute and Postgres, and the $5 trial credit covers your first experiments. That gives direct control over SQL variables and upgrades without a license negotiation.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Metabase Field Filters on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Metabase Field Filters self hosting

Railway attaches Postgres and injects MB_DB_* variables; traditional VPS hosts leave that plumbing to you.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Managed Postgres and env injection. | Manual Docker, PostgreSQL, and env setup. |
| AWS | No IAM or VPC work for a small stack. | EC2 plus RDS with more control, more networking config. |
| Hetzner | Predictable cost, no server patching. | Cheap servers, but you handle OS, Docker, Postgres, and HTTPS. |

For a single Metabase instance, Railway removes the plumbing; AWS wins only if you already run everything there.

## Common Use Cases for hosted Metabase Field Filters

- **Support ticket triage:** Ops writes a SQL question with a field filter on `status` and a date filter on `created_at`, then wires both to dashboard filters so agents can see open incidents by week without touching SQL.
- **Embedded customer analytics:** A SaaS product uses static embedding with an `account_id` field filter locked per customer, so each customer only sees their own rows.
- **Finance month-end review:** Analysts parameterize a revenue query with a field filter on `product_category` and a relative date filter on `transaction_date`, letting a dashboard show last quarter's margins per line of business.
- **Warehouse exception monitoring:** A logistics team writes a query with an optional clause like `[[AND {{warehouse}}]]`, so the same question runs for all sites or drills into one facility when a manager picks from the filter list.

## Dependencies for Metabase Field Filters Docker hosted on Railway

Field filters are just Metabase SQL questions with a typed template variable, so the only hard runtime dependency is the Metabase app itself plus a production Postgres database. Skip H2 entirely.

### Deployment Dependencies for Managed Metabase Field Filters Service (SQL BI with field filters)

The managed service needs a persistent volume on the Postgres service so the app database survives redeploys. Also set `MB_SITE_URL=https://public-domain`, `MB_PASSWORD_COMPLEXITY=strong`, and `PORT=3000`.

### Implementation Details for Metabase Field Filters (Using Metabase official docker image)

The official image runs first-boot migrations against the Postgres app database, so keep the volume attached and the connection variables stable. Give the app a health check at `GET /api/health`.

## How does Metabase Field Filters compare against other SQL-first BI tools platforms

### Metabase Field Filters vs Tableau (Tableau Alternative)

**Field filter syntax:** Metabase lets you write `WHERE {{state}}` with no column or operator, expanding to multiple values and date ranges. Tableau needs manual parameters for the same result.
**Where Tableau wins:** Pixel-perfect layouts and guided analytics. Metabase is cheaper and faster for SQL-first teams.

### Metabase Field Filters vs Apache Superset (Superset Alternative)

**SQL-native filters:** Superset requires explicit Jinja like `{{ filter_values('state') }}`; Metabase auto-generates SQL from the mapped column type, but gives less control over computed columns.
**Where Superset wins:** Stronger row-level security and multi-tenant governance. Metabase OSS is lighter and simpler.

### Metabase Field Filters vs Redash (Redash Alternative)

**Variable typing:** Redash treats `{{state}}` as a generic parameter; Metabase's Field Filter maps to the DB field, so dropdowns and date pickers follow the field type automatically.
**Where Redash wins:** A lighter, query-first UI that some developers prefer. Metabase is friendlier for non-SQL analysts.

### Metabase Field Filters vs Power BI (Power BI Alternative)

**Direct SQL filtering:** Power BI's DirectQuery supports report-level filters, but writing reusable parameterized SQL is not the primary workflow. Metabase builds field filters into the SQL question natively.
**Where Power BI wins:** Enterprise polish, Excel integration, and premium features. Metabase OSS is free under AGPL and cheaper to self-host.

## How to use Metabase Field Filters (the OSS SQL BI with field filters)?

1. Open the SQL editor and write `WHERE {{state}}` - no column, no operator. Metabase generates SQL for single values, multi-select, and date ranges.
2. In the variables panel, set type to Field filter, pick table and field. If the query uses an alias or CTE, fill the Table and field alias box (`p.category`).
3. Wrap optional filters in double brackets: `[[AND {{category}}]]`. The question runs even when the filter is empty.
4. Save and add to a dashboard. Connect the field filter to a dashboard filter to drive SQL and query-builder cards together.
5. For MongoDB native queries, put the field filter inside `$match`. For BigQuery, use backticks around tables; Oracle needs double quotes.

## How to self host Metabase Field Filters on other VPS Services (Metabase Field Filters self hosting guide)

### Clone the Repository

There is no app source to build; Metabase ships as the metabase/metabase image. Create a folder with a docker-compose.yml for metabase/metabase and Postgres, plus a volume.

### Install Dependencies

Install Docker and the compose plugin on the VPS. Pull metabase/metabase and the official postgres image.

### Configure Environment Variables

Point Metabase at Postgres, not the default H2 file.

```bash
MB_DB_TYPE=postgres
MB_DB_HOST=postgres
MB_DB_PORT=5432
MB_DB_USER=metabase
MB_DB_PASS=change-me
MB_DB_DBNAME=metabase
MB_SITE_URL=https://your-domain
```

Set MB_ENCRYPTION_SECRET_KEY before saving warehouse credentials and never rotate it.

### Start the Metabase Field Filters Application

Run docker compose up -d, open port 3000, and finish setup. Railway handles orchestration, networking, and Postgres for you.

## Official Pricing of Metabase Field Filters (Metabase Field Filters pricing)

Metabase Field Filters runs on the open-source Metabase codebase, which is free under AGPL. You only pay for your Railway compute and Postgres. Metabase Cloud Starter costs $100/month with 5 users included, then $6 per extra user. Pro jumps to $575/month with 10 users included and $12 per extra user. Enterprise starts at $20,000/year.

## Metabase Field Filters cloud vs self hosted comparison (Pricing, features, costs, and more)

Cloud Starter charges $100/month for 5 users, then $6 per extra seat. Field filters themselves cost nothing either way; the fork is where you run them.

### Monthly cost of self hosting Metabase Field Filters on Railway

A single-node stack with metabase/metabase and Railway Postgres 18 runs about $5-15/month on Hobby. You add your own MB_ENCRYPTION_SECRET_KEY before saving warehouse credentials, but that is configuration, not a line item.

### System Requirements for Hosting Metabase Field Filters on a VPS

For a typical dashboard with a few concurrent viewers, 1 vCPU and 2 GB RAM is enough for Metabase. The Postgres 18 side needs persistent storage for the app database and your field filter definitions. Avoid H2; it wipes on redeploy.

## Frequently Asked Questions (FAQs)

### Can I use a field filter with a CTE or aliased table?

Yes, fill the Table and field alias input. For FROM products AS p, use p.category; for a CTE, use the CTE name before the dot. Otherwise you get a SQL syntax error.

### Why does my optional filter break the query when empty?

Wrap the whole clause in double square brackets, like [[AND {{category}}]]. A bare AND with an empty variable leaves invalid SQL, while the brackets drop the clause cleanly.

### Can one field filter drive both SQL and query-builder dashboard cards?

Yes, wire the SQL question's field filter to a dashboard filter, then link that same dashboard filter to query-builder cards. Map the variable to the same field type so dropdowns and date pickers match.

### Should I use a field filter for a computed column?

No, use a basic variable. Field filters need a physical table and field because Metabase writes the SQL for multiple values and date ranges. A computed column has no mapping, so you get an error.

### Do field filters work in MongoDB native queries?

Yes, put the variable inside a $match stage instead of a WHERE clause. Map it to the target field, and Metabase generates the right operator for lists or date ranges.


## Similar templates

- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks | Open-Source Typeform & Qualtrics Alternative](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube
- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway

Open this page in a browser: https://railway.com/deploy/deploy-metabase-sql-field-filters
