Dealing with nulls in a tier dimension


(Brendan Vaughn) #1

Looking for some tips on how best to deal with null values in a tier dimension.

Our use case is for “days since last visit” which we’re calculating as a dimension for each visit; for guests who have their first visit, this value would logically be a null. For all other guests, this is an integer value.

One challenge is the way Looker displays nulls for style:integer is that it shows them as “Undefined”. It would be nice to have an override to pick what we show nulls as (perhaps something like “First Visit”), but until then we’re trying to find an elegant way to have something other than “Undefined” which to business could look like a data error.

One thought is simply to change our ETL to write the intervals as strings using case statements, but that would sort of do-away with the nice feature of tiered dimensions.

We tried but were unable to find a solution that uses the sql: function (such as a CASE statement).


(Kyle) #2

Hi @bmvaughn ,

One way to solve this would be to use parameters in the LookML. It would like something like this:

html:
{% if value == ‘Unspecified’%} First Visit
{% else %} {{ rendered_value }}
{% endif %}


(Brendan Vaughn) #3

Hadn’t even considered using Liquid. Great idea, thanks!


(Kyle) #4

Glad to help. Not sure why I said parameters tho :rofl: