Quick Reference Cheat Sheet¶
Quick reference for Dataface board structure and common patterns.
Board Structure¶
title: "Board Title" description: "Optional description" tags: [marketing, q1] theme: palette: "category10" css: "styles/custom.css" # Layout (Use exactly one: rows, cols, grid, tabs) rows: - _header_partial # Include other files - title: "KPIs" cols: # Nested layout - kpi_revenue - kpi_orders # Definitions (Scoped to this board) variables: region: input: select column: orders.region queries: revenue: description: "What this query powers" metrics: [revenue] dimensions: [month] charts: kpi_revenue: type: kpi query: queries.revenue metric: revenue
Query Templates¶
Semantic Layer (MetricFlow)¶
queries: sales: description: "Monthly revenue and order trends by region" metrics: [revenue, orders] dimensions: [month, region] filters: region: region # Link to variable date: "{{ date_range }}" # Link to date variable time_grain: month limit: 100
dbt Model¶
queries: raw_data: description: "Base order rows for detailed analysis" model: "ref('fct_orders')" columns: [order_id, amount, status] filters: status: "completed"
Raw SQL¶
queries: custom: description: "Orders above the current minimum threshold" sql: | SELECT * FROM orders WHERE amount > {{ min_amount }} profile: my_postgres
Chart Template¶
charts: revenue_trend: title: "Revenue Trend" description: "Tracks monthly revenue by region" query: queries.sales type: line # bar, line, area, scatter, kpi, table... x: month y: revenue color: region style: show_legend: true
Variable Template¶
variables: # Column-bound (Automatic options) region: input: select # select, multiselect, text, number... description: "Region filter applied to all charts" column: orders.region # Date Range date_range: input: daterange description: "Date range for report period" default: "2024-01-01 to 2024-01-31" # Custom Options status: input: select description: "Lifecycle status filter" options: static: [Draft, Active, Archived] # OR dynamic query: queries.statuses column: status_id label_column: status_name
Layout Templates¶
Rows (Vertical)¶
rows: - title: "Top Section" description: "Primary KPI context" cols: [...] - title: "Bottom Section" chart: trend_chart
Cols (Horizontal)¶
cols: - width: "30%" chart: sidebar_nav - width: "70%" chart: main_content
Grid¶
grid: columns: 12 row_height: "150px" items: - item: kpi_1 description: "Revenue KPI card" width: 3 - item: kpi_2 width: 3 - item: main_chart x: 0 y: 1 width: 12 height: 4
Tabs¶
tabs: position: top items: - title: "Overview" description: "Executive summary tab" rows: [...] - title: "Details" grid: {...}
Foreach (Dynamic Generation)¶
rows: - foreach: query: data: - name: "Revenue" type: "numeric" - name: "Orders" type: "numeric" as: col items: - title: "{{ col.name }}" content: "Type: {{ col.type }}"
Common Patterns¶
Filtered Query¶
variables: region: input: select column: customers.region queries: filtered: metrics: [revenue] filters: region: region # Applies selected region value
KPI Row¶
rows: - height: "120px" cols: - type: kpi query: queries.kpis metric: revenue - type: kpi query: queries.kpis metric: orders
Variable-Filtered Chart¶
variables: selected_category: input: select column: products.category charts: filtered_bar: type: bar query: queries.sales x: product y: revenue filters: category: "{{ selected_category }}"
Field Quick Reference¶
Common Chart Types¶
bar- Bar chartline- Line chartarea- Area chartscatter- Scatter plottable- Data tablekpi- Single numberheatmap- Heatmap
Common Inputs¶
select- Single dropdownmultiselect- Multiple dropdowndaterange- Date range pickertext- Text inputnumber- Number inputcheckbox- Toggle
Layout Keys¶
rows- Vertical stackcols- Horizontal stackgrid- 2D Gridtabs- Tabbed viewforeach- Dynamic generation from data
Expression Quick Reference¶
References¶
filters: simple: variable_name jinja: "{{ variable_name }}" default: "{{ variable_name or 'All' }}"
Formatting¶
filters: date: "{{ date_range | date('%Y-%m-%d') }}" number: "{{ amount | number('0.00') }}"
Logic¶
filters: conditional: "{% if show_all %} 1=1 {% else %} id={{ id }} {% endif %}"
Related¶
- Field Reference - Complete field definitions
- Faces Guide - Layout concepts
- Chart Types - Visualizations