Why Doesn't My Table Calculation Work in My Visualization?

  • 17 August 2021
  • 1 reply

The Problem

The data is set up how you would like, but when you select the visualization type, Looker says that the visualization is incompatible with your data (e.g. it requires one dimension and one measure). 


The Explanation

Even though the “Percent Profit” table calculation is performing a mathematical operation on my existing field, because I only reference a dimension in my table calculation, Looker will group and treat my table calculation as a dimension. 

ex: (${products.retail_price}-(${products.retail_price}*0.9))/3


Since the table calculation is still treated as a dimension, we are not meeting the measure requirement for the pie chart visualization. 



The Solution

To meet the measure requirement for the pie chart visualization, I will need to make sure a measure is referenced in my visualized fields. To do this without changing my data I can 

  1. Add a measure to my query


  2. Edit my table calculation to include + ${products.count}*0 at the end of it
    ex: ((${products.retail_price}-(${products.retail_price}*0.9))/3) + ${products.count}*0
  3. Hide my measure from the visualization

And now my visualization is based off my table calculation without changing my data! 



1 reply

It solved my problem, thank you!