Measure Date Abstraction
Measure Factory requires a dimension with the exact name of Date in each data set. However, in some cases, such as non-English environments, you can specify an alternate name for the Date dimension using the date-name option in the configuration file. This Date dimension must exist for the factory to process correctly. You can abstract input date dimensions that have multiple uses in separate measures in the scope blocks for each measure. This allows you to align all the measures from the factory output to a common date and allows each measure to look at the data differently.
For example, the input data set records for hospital Accounts have both Admit Date and Discharge Date fields. Admit Date is used to calculate the Total Admissions measure and Discharge Date is used to calculate the Total Discharges measure.
measure "Total Admissions" `count()` filter=`value("Admission") or value("Normal Newborn Account")` format="#,#" {
scope "Admissions"
}
scope "Admissions" data-set="Accounts" {
filter `value("Date") != null and value("Date") <= current_date()`
alias "Date" "Admit Date"
}
measure "Total Discharges" `count()` filter=`value("Discharge") or value("Normal Newborn Discharge")` format="#,#" {
scope "Discharges"
}
scope "Discharges" data-set="Accounts" {
filter `value("Date") != null and value("Date") <= current_date()`
alias "Date" "Discharge Date"
}
NOTE: Date-rollup dimensions cannot be aliased.