Skip to content

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:
    metrics: [revenue]
    dimensions: [month]

charts:
  kpi_revenue:
    type: kpi
    query: queries.revenue
    metric: revenue

Query Templates

Semantic Layer (MetricFlow)

queries:
  sales:
    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:
    model: "ref('fct_orders')"
    columns: [order_id, amount, status]
    filters:
      status: "completed"

Raw SQL

queries:
  custom:
    sql: |
      SELECT * FROM orders
      WHERE amount > {{ min_amount }}
    profile: my_postgres

Chart Template

charts:
  revenue_trend:
    title: "Revenue Trend"
    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...
    column: orders.region

  # Date Range
  date_range:
    input: daterange
    default: "2024-01-01 to 2024-01-31"

  # Custom Options
  status:
    input: select
    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"
    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
      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"
      rows: [...]
    - title: "Details"
      grid: {...}

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 chart
  • line - Line chart
  • area - Area chart
  • scatter - Scatter plot
  • table - Data table
  • kpi - Single number
  • heatmap - Heatmap

Common Inputs

  • select - Single dropdown
  • multiselect - Multiple dropdown
  • daterange - Date range picker
  • text - Text input
  • number - Number input
  • checkbox - Toggle

Layout Keys

  • rows - Vertical stack
  • cols - Horizontal stack
  • grid - 2D Grid
  • tabs - Tabbed view

Expression Quick Reference

References

filters:
  simple: variable_name
  jinja: "{{ variable_name }}"
  default: "All"

Formatting

filters:
  date: "{{ date_range | date('%Y-%m-%d') }}"
  number: "{{ amount | number('0.00') }}"

Logic

filters:
  conditional: " id={{ id }} "