About data modeling
Modeling your data in Data Studio consists of customizing the fields contained in your data sources so that your reports visualize that data in the desired fashion. You can then share and reuse those data sources to ensure that your reports are consistent.
There are 2 types of fields in Data Studio:
- Dimensions describe or categorize your data. Adding dimensions to a chart groups the data by those dimensions. Campaign name, Product ID, and Country are all examples of dimensions you might use to group the information in a chart. Note that any type of data can be a dimension, including a column of unaggregated numbers.
- Metrics measure your dimensions. A metric is the result of applying an aggregation to a set of values,. That aggregation could come from the underlying data set, or be the result of implicitly or explicitly applying an aggregation function, such as COUNT(), SUM(), or AVG().
This article explains how to configure default properties for fields in the data source, and how to override those properties, if needed, in a report.
Dimensions and metrics in your data source
When you connect to your data in Data Studio, you'll see the list of fields along with their default properties, as shown below. Dimensions (unaggregated columns that you can group by) appear as green fields. Metrics (aggregated data) appear as blue fields.
- Data source name (click to edit)
- Edit data source connection (available to data source editors only)
- Create calculated field button
- Fields (by row number):
- Calculated dimension
- Regular dimension
- Calculated metric
- Regular metric
All fields have the following properties, derived from the underlying data set:
This is the name that appears in any chart that uses this field. If the name is too long to display completely, hover over it until the full name appears.
To change the name, click the field and type a new one.
A field's data type tells Data Studio what kind of data to expect when processing the field. Data type determines how the data appears in your reports, which operations are allowed for it, and which are not. For example, you can't apply an arithmetic function to a Text field, or use a Number field as the date range dimension in a report.
Use the drop-down menu to change a field's data type.
Learn more about data types.
Aggregation is the method by which a field's data is summarized. A field's default aggregation method in the data source is applied when you use that field as a metric in a chart. If you use the field as a dimension, then you'll group the chart by that field instead. Report editors can change this at the chart level.
There are 3 possible default aggregations, depending on where the data comes from and how it's defined in the underlying data set:
None. This is the default aggregation for all dimensions containing non-numeric data. Fields with aggregation None are considered dimensions in Data Studio.
Sum. This is the default aggregation for all dimensions containing unaggregated, numeric data. Generally, this applies to number columns from tabular data sets, such as Google Sheets, CSV files, and BigQuery tables. Fields with aggregation Sum can be used either as dimensions or as metrics in Data Studio.
Auto. This is the default aggregation for all metrics coming from the data set, the connector, or a calculated field. Auto means that field's aggregation method is fixed and can't be changed. Auto fields are always metrics in Data Studio.
Learn more about aggregation.
Some data sources provide annotations, such as the underlying field name in a Google Analytics data source. You can edit the description by clicking it. Descriptions do not appear elsewhere besides the data source.
Calculated fields, type, and aggregation
Calculated fields let you create new fields derived from your data. Calculated fields appear in the field list with fx at the end.
The formula you use to create the field determines the data type and whether the result is an unaggregated dimension or an aggregated metric. For example, a formula that uses CONCAT() to build a URL from product codes creates a dimension of type Url with an aggregation of None. Or to create a Profit Margin field, you could use the formula
SUM(Profit) / SUM(Sales). The field created would be a Number with an aggregation of Auto.
Learn more about calculated fields.
Dimensions and metrics in reports
Adding a data source to a report lets anyone who can edit the report use the data source fields to build charts and configure controls. These fields appear in the DATA tab of the properties panel on the right whenever you have one or more charts or controls selected.
Dimensions and metrics in charts
Dimensions group data, with each dimension in a chart providing more and more granular detail. Metrics in charts are always aggregated numbers: the level of aggregation depends on the dimensions present, if any.
Learn how to add, replace, or remove fields.
For example, a table with the Country dimension and a single metric groups that metric by country. Adding the City dimension provides a further breakdown, first by country, then by city.
Charts with no dimensions, such as the scorecard or a table with all dimensions removed, display the ungrouped value of a metric.
Override default type and aggregation in charts
You can change default field definitions at the chart level in the following ways:
Use a dimension as a metric
- Using a non-numeric dimension field as a metric applies the Count Distinct (CTD) aggregation method to that data.
- Using a numeric dimension field as a metric applies the default aggregation that was specified in the data source, or Sum, if no default aggregation was specified.
Manually edit the field
In the properties panel, click a field's edit pencil to modify that field's definition. You can change the data type, aggregation method (for non-Auto aggregated fields), and apply comparison and running calculations.
To prevent report editors from changing these defaults, edit the data source and turn off Field Editing in Reports. Learn more about editing fields.