Grouping in a table calculation

Is there a way where a dimension can be grouped within a look? Ideally a table calculation as eventually this will be used in LookML Dashboard. I’m really looking for a nested if then, but struggling with the Yes, No

For example.
If I have Dimension= A, Dimension = B and Dimension = C, then X.
If Dimension= D, E or F, then Y
Else Z

Hi @mogburn!

This is definitely possible with a Custom Dimension, as long as the dimensions are from the same View!
At the moment it is still ‘Experimental’, under Admin -> Labs, but it is possible, and I have been used it quite often. Only with success!
Keep in mind that your button for Table Calculations will go away from the DATA bar, and everything shifts to the top, just above your list of Views on the left, below the Search box.

This works almost identically to a Table Calculation, but without the requirement of the underlying Dimensions to be present. It is treated as an actual dimension from LookML and will be grouped on.
So you would not write in SQL, but in the Looker Syntax, like:

if(
  Dimension = A AND Dimension = B AND Dimension = C
  , X
  , if(
    Dimension = D OR Dimension = E OR Dimension = F
    , Y
    , null
  )
)

Hope this helps!

Daan

1 Like