# Namespace measureFactory
Functions to create measures that aggregate, summarize, and accumulate data, plus show changes in data over time.
Measures created with these functions can be used in the data options of UI components such as Chart, ChartWidget, and ExecuteQuery.
# Example
Example of using React hook useExecuteQuery to query the Sample ECommerce
data source.
Factory function measureFactory.sum()
is used to create a measure that sums the Revenue
column.
const { data, isLoading, isError } = useExecuteQuery({
dataSource: DM.DataSource,
dimensions: [DM.Commerce.AgeRange],
measures: [measureFactory.sum(DM.Commerce.Revenue)],
filters: [filterFactory.greaterThan(DM.Commerce.Revenue, 1000)],
});
if (isLoading) {
return <div>Loading...</div>;
}
if (isError) {
return <div>Error</div>;
}
if (data) {
return <div>{`Total Rows: ${data.rows.length}`}</div>;
}
return null;
# Index
# Aggregation
# Arithmetic
# Time-based
- difference
- diffPastMonth
- diffPastQuarter
- diffPastWeek
- diffPastYear
- monthToDateSum
- pastDay
- pastMonth
- pastQuarter
- pastWeek
- pastYear
- quarterToDateSum
- weekToDateSum
- yearToDateSum
# Statistics
- contribution
- growth
- growthPastMonth
- growthPastQuarter
- growthPastWeek
- growthPastYear
- growthRate
- rank
- runningSum