It is sometimes the case that we need to create a pie chart, or any other chart that has row limits, but our raw data exceeds those limits.
We can always make Lookml or SQL Database changes to create buckets, such as seen here:
but that doesn’t always match our work flow.
My solution is an explore-only purely table calc driven solution.
There are 3 main parts.
- Creating a new dimension with “Others”, notice it is important to sort on your measure to make sure “others” matches the criteria:
- Creating a hide column, that allows us to use yes,no to hide certain rows so that they stay within our requirements:
This uses the “Hide No’s from Visualization” solution seen here: https://docs.looker.com/exploring-data/using-table-calculations#using_table_calculations_in_visualizations
- Integrating non-”other” dimensions with “other” dimensions:
What this allows us to do is to set a row amount that we want to appear in the visualization, and have all rows after that be grouped dynamically into the “Others” bucket, and have their measure data be rolled dynamically into the new measure table calc.
This can help create bucketing prototypes, or help out explore users who cannot change the lookml/backend sql.
row() function is not working in sql expressions in looker view.