Count
count.co
  • Getting Started
    • What is Count?
    • Count FAQ
    • Intro to your workspace
    • Example canvases
    • Getting started guides
      • Set up your workspace and projects
        • 1. Review workspace settings
        • 2. Create and organise your projects
      • Canvas orientation
      • Your first ad hoc analysis
        • 1. Examples and templates
        • 2. Build your first queries
        • 3. Create visuals
        • 4. Caching, local cells and scheduling
        • 5. Collaborating with a stakeholder
      • Your first report
        • 1. Examples and templates
        • 2. Filters and control cells
        • 3. Sharing your report
        • 4. Alerts
  • Connect your data
    • Database connection overview
      • Athena
      • Azure Synapse
      • BigQuery
      • Databricks
      • Microsoft SQL Server
      • MySQL
      • PostgreSQL
      • Redshift
      • Snowflake
    • Refresh database schema
    • Upload CSV files
    • dbt integration
      • ☁️dbt Cloud integration
      • 👩‍💻dbt Core integration
  • Import & Export
    • Import from other tools
      • Import Miro files
      • Import SQL files
      • Import Google Sheets
      • Import Jupyter notebooks
    • Export code and results
      • Export compiled SQL and Jinja-SQL
      • Export CSV files
      • Export images and PDF files
  • THE CANVAS
    • Navigating the canvas
      • Canvas tool bar
      • Data sidebar
      • Customizing the canvas
    • Canvas objects
      • Cells
      • Text and markdown
      • Shapes and tools
      • Sticky notes
      • Frames
      • Images
      • Embeds
      • Stamps
      • Grouping objects
      • Object order and alignment
      • Locking objects
      • Scaling objects
      • Shared styles
    • Overviews
    • Templates
    • Count AI
    • Alerts and subscriptions
      • Slack integration
    • Keyboard shortcuts
  • Querying data
    • Cells overview
      • Dynamic query compilation engine
    • SQL cells
      • Referencing other cells
      • Jinja templating
      • SQL formatting
    • Python cells
    • Visual and low-code cells
      • Calculations in visuals and low-code cells
      • Joins in visuals and low-code cells
    • Control cells
      • Single and multiple selects
      • Date controls
      • Text, number, and boolean controls
      • Custom control cells
    • Local DuckDB cells
      • DuckDB on the server
    • Query caching and scheduling
    • Manage queries and results
    • Troubleshooting
  • Visualizing data
    • Visualization overview
    • Templated visuals
    • Custom visuals
      • Marks
      • Facet
      • Subplots
      • Style
      • Filters
    • Formatting a visual
      • Axes
        • Secondary Axis
      • Colors and labels
      • Legends
      • Tooltips
    • Column summaries
    • Dynamic text
    • Every Visual Under the Sun
  • Presenting and Reporting
    • Reports and Slides
  • Count Metrics
    • Intro to Count Metrics
    • Build and edit a catalog
    • Views
      • Creating views
      • Customizing views
    • Datasets
      • Creating datasets
    • Save changes to the catalog
      • Catalog validation
      • Version control
    • Exposing catalogs to the workspace
    • Caching in Count Metrics
    • Using the catalog
      • Explore from cell
  • Sharing and Permissions
    • Real-time collaboration
    • Comments
    • Sharing permissions
    • Shared links
    • Embedding canvases
  • History and Versions
    • Version control
    • Duplicating and merging
    • Data snapshots
  • Settings and administration
    • Workspace settings
      • Workspace members
      • Groups
      • Tags
      • Billing
      • Single sign-on (SSO)
        • Okta
        • Entra ID
        • JumpCloud
        • Google
        • Generic OIDC
      • Brand
    • Connection settings
    • Project settings
    • User settings
    • Roles and permissions
  • Quick guides
    • Interactive control guides
      • Date ranges
      • Date groupings
      • Search
      • Select All
  • Resources
    • Join the Slack community
  • Blog
  • Security overview
  • Terms of use
  • Pricing FAQ
Powered by GitBook
On this page
  • View YAML schema
  • Building Views
  1. Count Metrics

Views

Catalogs are constructed of Views that represent your tabular data.

PreviousBuild and edit a catalogNextCreating views

Last updated 1 month ago

Views are a collection of fields (measures and dimensions) along with metadata, providing a flexible and efficient way to organize and manage your data. Views can be initialized quickly from database tables or canvas cells. Each view is stored in a separate YAML file, ensuring clarity and ease of customization.

View YAML schema

The schema for view definitions is displayed next to the YAML editor in Count. Expand the section below for an example view definition.

Show the view YAML schema
# This is the name of the view as it appears in code
name: events

# Optional caching and scheduling settings for the view
caching:
  duration: 360000
  schedule: 0 0 * * *

# The source query of the view - think of dependencies like cells in a canvas
source:
  connection: null
  query: SELECT * FROM events_df
  dependencies:
    - name: events_df
      query: SELECT * FROM `count-data`.demo_data.events
      connection: 7zoODN2N9UI

# The fields that are exposed from this view
fields:
    # The name of the field as it appears in code
  - name: event_id
    # An optional custom label for the field to display in the low-code UI
    label: Event ID
    # An optional custom description for the field to display in tooltips
    description: 'unique identifier for each event'
    # Change the field type to update the available aggregation options
    type: integer
    # Define a primary key for better joining between views
    primary_key: true
    # Optionally decide which aggregations are available for this field
    aggregates: [count_distinct, sum, min, max, avg,]
    # Optionally place this field within an expandable group
    group: My grouped fields

  - name: user_id
    label: User ID 
    description: 'unique identifier for each user'
    type: integer
    
  - name: timestamp
    label: Timestamp
    description: 'date breakout options'
    type: date
    # Optionally decide which temporal options are available for this field
    timeframes: [year_trunc, quarter_trunc, month_trunc, week_trunc, day_trunc, day_of_week]

  - name: events_per_user
    label: Events per User
    description: 'number of events per user'
    expression: count(distinct event_id) / count (distinct user_id)
    type: number

  - name: event_type
    label: Event Type
    description: 'type of event'
    type: string

  - name: workspace_id
    label: Workspace ID
    description: 'unique identifier for each workspace'
    type: integer

  - name: event_details
    label: Event Details
    description: 'details of event'
    type: string

Building Views

The next pages will guide you through creating and customizing your views.

– Learn how to set up new views to organize your data effectively.

– Adjust and refine your views to fit your specific needs.

Creating Views
Customizing Views
Catalog YAML editor