@@ -11,8 +11,8 @@ redirect_from:
1111---
1212
1313The ` dimensions ` property contains a set of dimensions. You can think about a
14- dimension as an attribute related to a measure, e.g. the measure ` user_count ` can
15- have dimensions like ` country ` , ` age ` , ` occupation ` , etc.
14+ dimension as an attribute related to a measure, e.g. the measure ` user_count `
15+ can have dimensions like ` country ` , ` age ` , ` occupation ` , etc.
1616
1717Any dimension should have the following properties: ` name ` , ` sql ` and ` type ` .
1818
@@ -185,6 +185,43 @@ cubes:
185185
186186</CodeTabs>
187187
188+ ### <--{"id" : "Parameters"}--> format
189+
190+ ` format` is an optional parameter. It is used to format the output of dimensions
191+ in different ways, for example, a link for `external_url`. Please refer to the
192+ [Dimension Formats][ref-schema-ref-dims-formats] for the full list of supported
193+ formats.
194+
195+ <CodeTabs>
196+
197+ ` ` ` javascript
198+ cube(` orders`, {
199+ // ...
200+
201+ measures : {
202+ total : {
203+ sql : ` amount` ,
204+ type : ` running_total` ,
205+ format : ` currency` ,
206+ },
207+ },
208+ });
209+ ```
210+
211+ ``` yaml
212+ cubes :
213+ - name : orders
214+ # ...
215+
216+ measures :
217+ - name : total
218+ sql : amount
219+ type : running_total
220+ format : currency
221+ ` ` `
222+
223+ </CodeTabs>
224+
188225### <--{"id" : "Parameters"}--> meta
189226
190227Custom metadata. Can be used to pass any information to the frontend.
@@ -348,9 +385,9 @@ cubes:
348385### <--{"id" : "Parameters"}--> sql
349386
350387` sql` is a required parameter. It can take any valid SQL expression depending on
351- the `type` of the dimension. Please refer to the [Dimension Types
352- Guide ][ref-schema-ref-types-formats-dimension- types] for detailed information on
353- the corresponding `sql` parameter .
388+ the `type` of the dimension. Please refer to the [Dimension
389+ Types ][ref-schema-ref-dims- types] to understand what the `sql` parameter should
390+ be for a given dimension type .
354391
355392<CodeTabs>
356393
@@ -451,9 +488,44 @@ cubes:
451488
452489</CodeTabs>
453490
491+ ### <--{"id" : "Parameters"}--> type
492+
493+ ` type` is a required parameter. There are various types that can be assigned to
494+ a dimension. Please refer to the [Dimension Types][ref-schema-ref-dims-types]
495+ for the full list of dimension types.
496+
497+ <CodeTabs>
498+
499+ ` ` ` javascript
500+ cube(` orders`, {
501+ // ...
502+
503+ dimensions : {
504+ rating : {
505+ sql : ` rating` ,
506+ type : ` number` ,
507+ },
508+ },
509+ });
510+ ```
511+
512+ ``` yaml
513+ cubes :
514+ - name : orders
515+ # ...
516+
517+ dimensions :
518+ - name : rating
519+ sql : rating
520+ type : number
521+ ` ` `
522+
523+ </CodeTabs>
524+
454525[ref-schema-ref-joins]: /schema/reference/joins
455- [ref-schema-ref-types-formats-dimension-types]:
456- /schema/reference/types-and-formats#dimensions-types
457526[ref-subquery]: /schema/fundamentals/additional-concepts#subquery
458527[self-subquery]: #sub-query
459528[ref-naming]: /data-modeling/syntax#naming
529+ [ref-schema-ref-dims-types]: /schema/reference/types-and-formats#dimension-types
530+ [ref-schema-ref-dims-formats]:
531+ /schema/reference/types-and-formats#dimension-formats
0 commit comments