Field note · September 24, 2023

Five minutes with industry in saas-subscriptions

2,500 rows, 8 distinct values, and the one fact about industry that changes how you query it.

1 min read ·Data quality ·quality practice

Someone asked what is in industry on saas-subscriptions, and the honest answer took one query.

2,500 rows, no nulls, 8 distinct values. Self-reported industry.

8 values, and they are not evenly spread: healthcare 13.4%, public sector 13.4%, software 13.0%, retail 12.6%. The largest takes 13.4% on its own.

Read the distinct list rather than the distinct count. Casing differences and trailing whitespace produce values that look identical in a report and group separately in SQL, and the count will not show you that — select distinct industry order by 1 will, in about a second.

sql
select
  count(*)                   as rows,
  count(industry)            as present,
  count(*) - count(industry) as nulls,
  count(distinct industry)   as distinct_values
from saas_subscriptions;

8 values is past the point where a bar chart stays readable. Group the tail explicitly rather than letting a chart library decide which 0 categories to drop for you.

Where this bites: a group-by on this column produces 8 rows today. If it is a column an upstream system can add values to, it produces an unknown number tomorrow, and any dashboard laid out for 8 categories reflows without warning. Values arriving is a schema change that no schema check catches.

The grain is one row per account, which is the context every one of those numbers depends on. None of them survive a change of grain, which is why "profile the column" and "profile the table" are the same job. Full schema, and the CSV, on the dataset page.