Using lists in table calculations (3.36+)

As of Looker 3.36, we have introduced the concept of lists in table calculations. Lists allow you to group values together and then perform a common calculation across them. Read using pivot_row lists here.

The list function allows you to create your own list. For example, let’s say I I have this table:

f811a076b8652f298a4acd816ce8644f25b4b00e.png

I want to know create a column that gives me the max of either the value of Orders Count, or the average of these 5 rows. I can do this by first creating a list of the average and the Orders Count value:

list(mean(${orders.count}),${orders.count})

This will list those two values like so:

1d8dc8c2225ba5568ca6addbcca6ea8ee2462a61.png

Then, I can take the max of that list, like so:

max(list(mean(${orders.count}),${orders.count}))

This will create a list of the average and whatever value is in each row for Orders Count. Then it takes the maximum of those two values.

1ab685545219edc55fe972d9f6504a9ab99e8e39.png

Lists are particularly useful for aggregating across values that aren’t physically in your table. This could be a hard-coded value (e.g. 14) or a value derived from the data in the table (e.g. mean(${orders.count}).`

1 14 12.6K
14 REPLIES 14
Top Labels in this Space