Measures
Measures are measurements that can go up and down over time. Each measure should map to a measurement of a process or workflow in your organization. Counts of events, revenues and cycle times are good examples of measures you may want to add to your data model.
You can setup and update measures from the Add Data Model workflow.
Types of measures
Name | Input Column Type | Description |
---|---|---|
row count | No input column required | Count of rows. |
custom measure | No input column required | A SQL-based custom aggregation. See Custom SQL Measures for more details. |
count | String or Numeric | SQL COUNT() . Counts the number of non-null values in a column. |
count distinct | String or Numeric | SQL COUNT(DISTINCT) . Counts the number of unique, non-null values in a column. |
min | Numeric | SQL MIN() . Finds the minimum value of a column. |
max | Numeric | SQL MAX() . Finds the maximum value of a column. |
avg | Numeric | SQL AVG() . Finds the arithmetic mean of a column. |
The row count measure
The row count measure is added by default to a data model and can't be removed. This is intentional - see the best practices for defining this measure in the Data Modeling Best Practices.
Column aggregations
The simplest type of measure. See table above for which functions you can run on specific measures.
To add a column aggregating measure:
- Go to the Add Data Model workflow by creating a new data model or editing an existing model.
- In the list of fields, click
Add measure
next to the name of the field you'd like to aggregate. - Click on the new item in the measure list to expand the and select the aggregation type.
Custom SQL measures
Custom SQL measures allow you to have more involved custom aggregations in Hashboard like weighted averages or proportions and other formulas. You can define a custom measure as any aggregating function (opens in a new tab) that results in a numeric value.
To add a custom measure:
- Go to the Add Data Model workflow by creating a new data model or editing an existing model.
- Under the Measures section click the
+ Add Custom Measure
button. - Enter your aggregation and click the 🔄 button to test the SQL.
Referencing other measures or attributes
Custom measures can refer to other measures or attributes to avoid duplicating logic. For instance, a Profit measure could be defined by deducting the Costs measure from the Revenue measure.
{{ revenue }} - {{ cost }}
SQL can reference other measures or attributes by surrounding their alias
in double curly braces.
When querying, Hashboard will expand references to their full definitions.
Using joined columns in custom SQL
See Using Joined Columns in Custom SQL for more info.
Measure folders
You can organize your measures and attributes into folders to keep your data model tidy and easy to navigate.
To organize your measures into folders in a data model:
- Open the data model in the Model builder.
- Select the measure you want to move to a folder.
- In the measure configuration pane, locate the
Folder
input field. - To move a measure into an existing folder, select the folder in the dropdown. To create a new folder, type the desired name into the search input and click the option to
Add
a new folder with that name. - Repeat steps 2-4 for each measure you want to organize into a folder.
- Once you’re finished, save the data model.
- Start exploring the data model, and you’ll see your folders in the Data tray.