Skip to content

Commit

Permalink
Update cube.md
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov authored Jan 14, 2020
1 parent c87b525 commit 9bf6e1e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/Schema/cube.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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.
Expand Down

0 comments on commit 9bf6e1e

Please sign in to comment.