Joins and measures
The rules that keep totals right.
Facts and dimensions
A fact table holds events or snapshots: sales lines, returns, weekly stock. A dimension table describes them: products, stores, dates. You can also mark a table ignored.
Joins
Joins are many-to-one, from a table holding a key to a dimension table with one row per key. They can cross files. Before saving, QuackUI checks that:
- the target columns are a primary key, a unique key, or unique in the data;
- the column types match;
- joins don’t form a loop;
- no table reaches the same dimension by two paths.
A fact never joins directly to another fact. They meet through shared dimensions, which is what makes multi-fact tables correct.
Joins keep fact rows. A sale with an unknown store still counts, under an empty store.
- Aggregation and additivity for each measure.
Measures
| Aggregation | Gives |
|---|---|
| Sum, average | The total or mean of a numeric column |
| Minimum, maximum | The lowest or highest value, dates included |
| Count | Rows, or non-empty values of a column |
| Count distinct | How many different values |
Report authors can pick another aggregation for a measure in a block without changing the model.
Additivity
| Kind | Behaves | Examples |
|---|---|---|
| Additive | Adds up in every direction | Net sales, quantity |
| Semi-additive | Adds up in every direction except time, where the latest value counts | Stock on hand, account balance |
| Non-additive | Never added. Recomputed from rows at each level | Average price, distinct customers, Margin % |
A semi-additive measure names a date. When that date is in the block, each row shows its own date’s value. When it isn’t, only rows at the latest date in each group count. QuackUI assumes a snapshot is complete for each date it has.
Two ways to count customers
A count on the customers table counts everyone in it. A count distinct of customer on sales counts those who bought something, and can be split by product or store. For large dimension tables QuackUI proposes the second when it drafts. If you use the first where it can’t reach, the error suggests the second.
