Building visualizations
This page will help you with some of the basics of how to prep data and configure your visualizations in Looker.
Last updated
Was this helpful?
This page will help you with some of the basics of how to prep data and configure your visualizations in Looker.
Last updated
Was this helpful?
Here are some useful tools for getting the data to display exactly as you want before fine-tuning the visualization.
If you want a dimension to populate into columns instead of rows, you can do so easily using the dimension pivot feature.
This is also useful if you want each value for the dimension to be broken out as a separate series in your chart.
Think of table calculations as a way to perform Excel-like functions on the data returned in a query. They are ad-hoc fields that allows you to display the output of a calculation involving one or more measures that already exist in your table.
Looker provides shortcuts for doing some of the most common table calculations:
% of column
% of previous row
% change from previous row
Rank of column
Running column total
Here's how to use those shortcuts:
However, if you have more specific needs for your table calculation, you can create one from scratch, like this example showing how to perform a calculation using two numbers in the chart:
Iin the editor, start typing the name of the field in your query that you want included in the table calculation, and then choose it when it appears in the list.
Looker makes it easy to include row and column totals in the data:
If you want to roll up values from an existing dimension into larger groups, you can create a new grouped dimension. This acts like a normal IF statement in Excel or Google Sheets, where you can define an output and the input rules, along with a fallback value.
This is also helpful if you want to simply rename the output of a dimension in a visualization without having to touch your database.
If you need to apply a filter to a single measure (rather than all dimensions and measures) you can create a filtered measure on the fly. For example, you could use a filtered measure if you want to show a count of all orders next to a count of new orders.
Here are some common use cases for data visualizations along with instructions on how to accomplish them.
If you want each value returned in a dimension to be broken out into its own series, you should Pivot the dimension:
To create a stacked bar chart, you must:
Have a dimension pivoted (see the previous section for details on that)
Switch to a column chart visualization
Choose "Stacked" series positioning in the visualization editor
To create a tile with a big number and a comparison number:
Add the measure you want for the big number and the measure you want for the comparison measure. The big number will be the left-most number, and the comparison measure will be the next measure. If you add more than 2 measures, it will always only show the two left-most measures.
Choose the Single Value visualization
In the visualization editor, go to the Comparison tab and toggle on "Show Comparison"
Make adjustments to the options in the Comparison tab until it displays correctly
Note: If you need more than 2 measures in the Data pane to create a calculation for your visualization, you can add them and then hide the columns that you don't want displayed (see next section for details).
There are some cases where you may need to include a field in the data table but not want it included in your visualization. For example, if you want to visualize only a table calculation but not the other fields that are used in the calculation. In this case, you can hide the columns that you don't want displayed in your chart or table.
To hide the field:
Click on the gear icon for that column in the data pane
Choose "Hide this field from visualization"
If you want to have a combination of columns and lines in your chart:
Choose either the column or line visualization type
In the visualization editor, go to the series tab
Expand the series you want to switch to a column or a line, and change the type
If you want to create two Y axes so that they are scaled independently:
Open the visualization enter and go to the Y tab
Drag the measure you want plotted onto a second Y axis to the Right Axes section
Looker documentation includes that will be helpful for table calculations. Below is a list of commonly used functions.
Returns the value of the pivot_expression
in position (n + col_offset)
, where n
is the current pivot column position. Returns null for unpivoted results.For examples using pivot_offset
, see the Community post and the Best Practices page.
Evaluates expression
in the context of the pivot column at position pivot_index
(1 for first pivot, 2 second pivot, etc.). Returns null for unpivoted results.For examples using pivot_index
, see the and Community posts.