Dynamically apply calculation to all table values

Hi everyone!

Little stuck on on something…

Image that there is a table with one dimension with a bunch of measures, in this case they are all percentages values.  I would like to create a filter with 2 selections that have the following choices: Total, Percentage.  Meaning if I select Total those percentage values for ALL of the metrics in the table will flip from % to totals and vice versa.

I know I can create dynamic measures to change an individual metric but not sure if it possible based on a selection to tell it to take the values in the table and change the calculations of the denominator.

In my head what I’m thinking is…

If Total is selected then divide by 1 which will give me the same results as the Totals

if Percentage is selected then divide all the values in the table by the sum of the total for a measure.

How anyone know how I might accomplish this in the lookML file?

Thanks!

0 2 170
2 REPLIES 2

Did you find a solution to your question? I am having the same problem

You could either have measures for every total & percentage combination and dynamically change between them using a parameter or you could use a liquid if else statement to change the logic of how you are calculating a measure. Here are the docs that will help you.

https://cloud.google.com/looker/docs/reference/param-field-parameter#using_parameter_with_liquid

Top Labels in this Space