This guide provides a step-by-step approach to utilizing custom SQL for creating metrics, which can enhance your data analysis capabilities.
1
Access Custom SQL
On the Create Metric page, select the “Custom Query” option.
2
Query Execution
In the Query Editor, enter your custom SQL query.Use the “Format Query with AI” option to align with Databrain’s best practices.Click “Run Query” to execute.
3
Preview the Results
Once the query runs, review the Query Result section to view your raw SQL output in a table.You can download the results as CSV if needed.
4
Save your Query Result
Click Use Results > to proceed. You can save it in the following ways: 1. Table ChartClick “Use as Table Chart”, configure additional settings, and save it to your dashboard.
2. Table Chart with Dynamic Table PropertyThis automatically adjusts to the latest structure of your SQL query result — ideal for evolving datasets using SELECT *. 3. Publish as Custom DatasetProvide a dataset name, choose a schema, and click Save.
4. New ChartSelect your preferred chart type, configure it, and save.
5
Edit Custom Query
At any point, you can switch between the Chart Builder and the Query Editor.Make changes to your SQL and immediately view updated results in both areas.