Skip to content

Commit c3eeb50

Browse files
authored
Update schema-execution-environment.md
1 parent 38361fd commit c3eeb50

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/Schema/schema-execution-environment.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,24 @@ cube(`Users`, {
200200
}
201201
});
202202
```
203+
204+
So for example if you want to pass definition of `ratio` outside of the cube you should define it as:
205+
206+
```javascript
207+
const measureRatioDefinition = {
208+
sql: (CUBE, count) => `sum(${CUBE}.amount) / ${count}`,
209+
type: `number`
210+
}
211+
212+
cube(`Users`, {
213+
// ...
214+
215+
measures: {
216+
count: {
217+
type: `count`
218+
},
219+
220+
ratio: measureRatioDefinition
221+
}
222+
});
223+
```

0 commit comments

Comments
 (0)