How do I visualize a dimension as a measure?

Knowledge Drop

Last tested: March 2021

You may be wondering how to plot a dimension on the y-axis of a visualization.

Quick Solution

The quick way to do this is with a table calc involving an existing measure.
${dimension} + ( ${measure} * 0)

A similar approach can be taken with this table calc for a String dimension
if(is_null(measure),string_dimension,string_dimension)

More details on this method in the Help Center article here.

 

Proper Solution

The right way to do this is with an aggregate in LookML.

measure: sum_dimension {type: sumsql: ${dimension} ;;}

This content is subject to limited support.                

Version history
Last update:
‎04-05-2021 09:04 AM
Updated by: