Manipulating data to support your business objectives is known as "data modeling."
In Data Studio, the fields in a data source certain properties, such as name, data type, and aggregation. These properties are provided by the connector used when the data source was created. This article describes field properties so you can better understand how to customize those properties so that your reports display the data the way you want.
Types of fields
A data source can contain the following kinds of fields:
- Dimensions describe or categorize your data. Dimensions contain unaggregated data. Dimensions appear as green fields in the data source editor and report properties panel.
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. Metrics contain aggregated data. Metrics appear as blue fields in the data source editor and report properties panel.
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().
- Calculated fields are fields you create by applying functions, operators, and/or branching logic to your data. A calculated field appears as metric or dimension depending on the output of the formula.
- Parameters store user-defined data. You can use parameters to customize or personalize your reports and data sources based on user input or variables defined in the underlying data set, such as a BigQuery custom query parameter.
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.
COUNT(Customer Name)returns the number of non-unique customers in your data. You can't, however, apply math functions to non-numeric dimensions:
SUM(Customer Name)returns an error.
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.
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.