A fact_schema
object is created, the essential data is a name and
a set of measures that can be empty (does not have explicit measures).
It is part of a star_schema
object, defines the facts of the star schema.
Arguments
- name
A string, name of the fact.
- measures
A vector of measure names.
- agg_functions
A vector of aggregation function names, each one for its corresponding measure. If none is indicated, the default is SUM. Additionally they can be MAX or MIN.
- nrow_agg
A string, name of a new measure that represents the COUNT of rows aggregated for each resulting row.
Details
Associated with each measure there is an aggregation function that can be SUM, MAX or MIN. AVG is not considered among the possible aggregation functions: The reason is that calculating AVG by considering subsets of data does not necessarily yield the AVG of the total data.
An additional measure corresponding to the COUNT of aggregated rows is added which, together with SUM, allows us to obtain the AVG if needed.
See also
Other star schema definition functions:
define_dimension()
,
define_facts()
,
dimension_schema()
,
star_schema()