Skip to content

Prepare your data

By the end of this section you will have one table or view in your warehouse that BInbox reads correctly the first time, and a few queries that prove it.

BInbox reads one table or one view and adds its numbers up as they come. It joins nothing, and it does not guess which rows you meant to count twice. A figure on a card is therefore only as right as the rows under it, and the work that makes the rows right is cheaper in your warehouse, where you know the data, than on a card where someone notices a total is wrong.

Each page in this section pairs a Don’t with a Do, using small tables of made-up rows. The pairs show what goes wrong and what to build instead.

Check Why it matters Page
One row for each thing you count A join that repeats an order on each of its lines adds the order’s amount once for each line. One row for each thing
No total rows among the detail rows BInbox adds a total row to the rows it totals, so everything counts twice. One row for each thing
Amounts and the base of each rate, not the rate alone A percent cannot be added up, and an average of averages is wrong. One row for each thing
One date column, typed as a date or a timestamp The column’s type decides whether it is the date. A date written as text is a dimension, and the table has no date. Dates, numbers and codes
Numbers stored as numbers Text that looks like a number is never added up. Dates, numbers and codes
Codes stored as text, with a name that says what they are A numeric code is added up as an amount unless its name marks it as an id. Dates, numbers and codes
Null for a missing value A stand-in such as 0 or 1900-01-01 is counted as a real value. Dates, numbers and codes
Every period kept A comparison with the prior period or a year earlier needs the earlier rows. History, repeats and size
One current row for each thing that changes Each change that adds a line counts again, unless you answer the strip’s question. History, repeats and size
A partition on the date column The rows you choose under Rows to read are the only rows a partitioned table scans. History, repeats and size

A worked example builds one view from four tables and ends with the queries that check it.

BInbox reads each column’s type in the warehouse before it reads a row, and the type sets the column’s role, as Pick a table lists. It then reads the first 10,000 rows for counts, first values and checks, and the strip over the Dashboard asks the few questions the rows raise, as Check the setup describes. Preparation does not replace those checks. It makes sure they have little to find.

  1. Make the view in your warehouse and run the checks on the worked example page against it.
  2. Make a read-only login for BInbox that can read the view and the tables under it, from the guide for your warehouse in Connect a warehouse.
  3. Pick the view in BInbox, as Pick a table describes.