How To Change Datatype

o change a field’s data type, use the Type drop-down menu in the data source edit page. If the field editing in reports option is enabled for the data source, you can also change a field’s data type directly in reports based on this data source.

If the field editing in reports option is enabled for the data source, you can also apply custom value formatting to Number and Date & Time type fields, without sending additional SQL queries to the database.

Enable/disable field editing in reports

You enable or disable field editing in reports at the data source level. New data sources have this option turned on by default. You must be able to edit the data source to change this.

To turn this off or on (for older data sources), follow these steps:

  1. Edit the data source(s) used in your report
  2. In the data source header, click Field Editing in Reports.

How editing fields in reports works

When you create a report based on a data source that has the Field Editing in Reports setting turned on, all the fields in the report that use the data source become editable. This option applies to all reports that use that data source. To edit a field definition in a report, follow these steps:

  1. Create or edit your report.
  2. Add a new chart or select an existing chart.
  3. In the Setup tab of the Properties panel, click a field’s data type icon to open the field’s edit menu. 
A user hovers a cursor over a dimension Type icon on the Setup tab of the chart Properties panel to edit the field type.

What you can edit

Editing a field lets you change the following:

  • The field’s name. For example, you can rename Order Value to Average Order Value.
  • A metric’s aggregation. For example, you can recalculate Order Value from Sum to Average.
    • This option isn’t available if the field is a metric with Auto aggregation type.
  • The field’s data type. For example, you can convert a Number to a Percent, or Text to a URL, or a full Date to a date part.
  • A metric’s comparison calculation. For example, you can apply a Percentage of Total function to your orders.
  • A metric’s running calculation. For example, you can show running sums of your data, record by record.
  • calculated field formula, a custom bin definition, or a custom group definition.
  • A dimension’s drill actions (for table charts only).
  • custom value format for a Numeric or Date & Time type dimension, metric, or calculated field. 

Learn more about comparison and running calculations.

Any changes that you make to a given field apply only to that instance of that field in that chart. For example, if the Average Order field appears in a table and a bar chart in the same report, changing any of the attributes of that field in the table has no effect on the Average Order field in the bar chart.

Rename a field

You can change a field’s display name in the selected chart. This lets you have multiple instances of the same field in a chart. For example, you can add two instances of the Order Value field to a table and change the name of the second instance to Average Order Value. Use the aggregation options that are described next on this page to change how the field is calculated.

Change the field aggregation

A field’s aggregation determines how its data is calculated in the chart. You can select from the following aggregations:

  • Average
  • Count Distinct
  • Count
  • Max
  • Median
  • Min
  • Standard deviation
  • Sum
  • Variance

Metrics with an aggregation of Auto can’t be changed.

Change the field data type

A field’s data type tells Looker Studio what kind of data to expect as input. For example, Looker Studio displays Text fields “as is,” with no other processing. Even if the field contains numbers, Looker Studio won’t apply any numeric aggregation to it. A field defined as a URL, on the other hand, is displayed as a hyperlink.

When the specified data type and actual data don’t match, unexpected results can occur. You can adjust a field’s data type in circumstances when the data source hasn’t been correctly configured and you don’t have edit access to it. For example, converting a dimension containing valid data but defined as Text to a Date type can let you use it as date range dimension.

You can also further customize how Numeric and Date & Time field type values are displayed by applying custom value formatting to dimensions, metrics, and custom fields in charts.    

Change the date granularity

Changing a Date & Time field type aggregates the data by the new type. For example, instead of grouping your data by year, month, and day, you can group by year and month.

For example, if the date field contains the complete year, month, and day, you can group by year quarter.

Example

The following tables show the same data. The first table groups Qty Sold by Date and Item, listing each item and Qty Sold more than once; the second table groups Qty Sold by Item with the time granularity set to Year Quarter, which results in each item listed once with their quarterly Qty Sold for Q4.

DateItemQty Sold
Oct 1, 2016Healthy Dog Dog Food3
Oct 1, 2016Hungry Kitty Cat Food1
Oct 1, 2016Pretty Bird Bird Seed5
Oct 1, 2016Happy Cat Catnip1
Oct 2, 2016Pretty Bird Bird Seed3
Oct 2, 2016Happy Cat Catnip2
Oct 2, 2016Parrot Perch4
Oct 3, 2016Playful Puppy Toy9
Oct 3, 2016Hungry Kitty Cat Food2
Oct 4, 2016Pretty Bird Bird Seed5
 Grand Total62
DateItemQty Sold
Q4, 2016Pretty Bird Bird Seed20
Q4, 2016Healthy Dog Dog Food16
Q4, 2016Playful Puppy Toy11
Q4, 2016Parrot Perch8
Q4, 2016Happy Cat Catnip4
Q4, 2016Hungry Kitty Cat Food3
 Grand Total62

To change how compatibility mode dates group the data, use the Granularity option, not the Type option.

You can also further customize how Numeric and Date & Time field type values are displayed by applying custom value formatting to dimensions, metrics, and custom fields in charts.

Scroll to Top