Looker Community

Best practices for dynamic value in calculations

As our product manager, I’m trying to get insights into our application usage via Looker. I have other tools and we’ll be moving to some more intelligent logging-based analytics, but one of the key things that I’d like to see in the short term is the percentage of customers (b2b) using a particular feature.

I know our customer count. For simplicity, let’s say it’s 100. And I can get this value by filtering my companies table by doing a simple attribute search where company type = customer.

However, when I’m working to conduct counts on feature usage with joins back to the companies table, many individual company count rows will revert to zero, and therefore are removed from the returned results. For example, if a company has no records of using feature X, then they are removed from my query count and don’t show up as a row. So my total count of companies in this query is no longer 100, but 90. What I would really like to do is to be able to say, tell me the percent of customers who have used this feature in the last X days.

If that is totally unintelligible, what I’m trying to do is figure out a way to dynamically set the denominator in the calculation (customers using feature X / active customers).

I image there are various SQL-based and Looker approaches to this problem, but I’m not sure what the best practice here is. I was thinking if I could define the variable active-customer-count somewhere, and it would dynamically determine the active customers as we grow/shrink, I could use that in my explore calculations. However, I’m not sure a) if that’s possible or b) if that’s a good approach. Any insights would be appreciated.