From 9bf6e1e9d33c4b5f3225bccbf84d9f5feb14e1e4 Mon Sep 17 00:00:00 2001 From: Pavel Tiunov Date: Tue, 14 Jan 2020 09:28:09 -0800 Subject: [PATCH] Update cube.md --- docs/Schema/cube.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/Schema/cube.md b/docs/Schema/cube.md index 0dd04e726df6d..e35bd9ffb236a 100644 --- a/docs/Schema/cube.md +++ b/docs/Schema/cube.md @@ -204,6 +204,12 @@ examples below. ```javascript cube(`OrderFacts`, { sql: `SELECT * FROM orders WHERE ${FILTER_PARAMS.OrderFacts.date.filter('date')}`, + + measures: { + count: { + type: `count` + } + }, dimensions: { date: { @@ -220,7 +226,18 @@ This will generate the following SQL: SELECT * FROM orders WHERE date >= '2018-01-01 00:00:00' and date <= '2018-12-31 23:59:59' ``` -for the `['2018-01-01', '2018-12-31']` date range passed for the `OrderFacts.date` dimension. +for the `['2018-01-01', '2018-12-31']` date range passed for the `OrderFacts.date` dimension as in following query: + +``` +{ + measures: ['OrderFacts.count'], + timeDimensions: [{ + dimension: 'OrderFacts.date', + granularity: 'day', + dateRange: ['2018-01-01', '2018-12-31'] + }] +} +``` You can also pass a function instead of an SQL expression as a `filter()` argument. This way you can add BigQuery sharding filtering for events, which will reduce your billing cost.