Logical functions in explorer

  • 13 April 2017
  • 1 reply


I am trying to create a table calculation to group bunch of different records using if statement. For example I have two different values for a field ‘default’ and ‘Default’ and I wrote a formula as follows:

if field=‘default’ then return ‘Default’. When I ran the data it returned two values for ‘Default’ instead of aggregating values. Not sure if i am missing something but I would really appreciate any help with this.

Thank You

1 reply

Userlevel 6

You’ll need to do this at the model layer. The table calculation layer calculates after the results have been aggregated. The advantage of fixing this at the LookML level is that it is fixed for good.

dimension: something {
sql: CASE
WHEN ${TABLE}.something = 'default' THEN 'Default'
ELSE ${TABLE}.something
END ;;