fact_sessions
(grain = session)fact_pageviews
(grain = page view), typically connected to its session by session_id
with a many:1 relationship.sales_daily_fact
: 1 row per store per day.sales_monthly_fact
: 1 row per store per month. The computation would include end-of-month adjustments, so it is not a simple transformation from sales_daily_fact
.UNION ALL
to union multiple grains rather than UNION
for significantly faster performancefact_sales
that records per store both the daily and the monthly sales volume, as indicated in the grain
column.
If naively counting per store sales volume as SUM(sales)
, the result would be wrong: it would double count daily and monthly totals.
When operating with multi grain data, must always deduplicate it.
There are two deduplication approaches:
dim_grain
with the list of possible grains. That would be used by the user to choose current grain by filtering on it.GET_FIELD_SELECTION
, see conditional filtering.GET_FIELD_SELECTION
, see conditional filtering.