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

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). 

c7c84d24-c478-4157-9e11-b36baab3f133.png

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! 

4f9d0e0f-b77d-45d2-9c38-b4e890c3a279.png

 

Comments
dnavia
New Member

It solved my problem, thank you! 

Version history
Last update:
‎08-16-2021 09:28 PM
Updated by: