Skip to content

Commit c67f57e

Browse files
committed
docs: Note on naming of extra columns for date hierarchies in DAX API
1 parent 02c4cc4 commit c67f57e

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

docs/pages/product/apis-integrations/dax-api.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,16 @@ To enable or disable the DAX API on a specific deployment, go to <Btn>Settings</
4343
in the Cube Cloud sidebar, then <Btn>Configuration</Btn>, and then toggle the
4444
<Btn>Enable DAX API</Btn> option.
4545

46-
By default, the DAX API exposes all [time dimensions][ref-time-dimensions] as calendar
47-
hierarchies. You can set the `CUBEJS_DAX_CREATE_DATE_HIERARCHIES` environment
48-
variable to `false` to disable this behavior.
46+
### Date hierarchies
47+
48+
By default, the DAX API exposes all [time dimensions][ref-time-dimensions] as _date
49+
hierarchies_ in [Power BI][ref-power-bi]. You can set the `CUBEJS_DAX_CREATE_DATE_HIERARCHIES`
50+
environment variable to `false` to disable this behavior.
51+
52+
Note that each date hierarchy will include additional columns, suffixed by `_year`,
53+
`_quarter`, `_month`, `_day`. If the data model has other members with names that follow
54+
this pattern (e.g., a time dimension named `date` and another dimension named `date_year`
55+
in the same cube or view), that would cause a conflict.
4956

5057
## Authentication
5158

@@ -72,4 +79,4 @@ The DAX API only exposes [views][ref-views], not cubes.
7279
[ref-time-dimensions]: /product/data-modeling/concepts#time-dimensions
7380
[ref-kerberos]: /product/auth/methods/kerberos
7481
[ref-ntlm]: /product/auth/methods/ntlm
75-
[ref-power-bi]: /product/configuration/visualization-tools/powerbi#connecting-from-power-bi
82+
[ref-power-bi]: /product/configuration/visualization-tools/powerbi

docs/pages/product/data-modeling/syntax.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Common rules apply to names of entities within the data model. All names must:
8080
- Start with a letter.
8181
- Consist of letters, numbers, and underscore (`_`) symbols only.
8282
- Not be a [reserved keyword in Python][link-python-reserved-words], e.g., `from`, `return`, or `yield`.
83+
- When using the DAX API, not clash with the names of columns in [date hierarchies][ref-dax-api-date-hierarchies].
8384

8485
It is also recommended that names use [snake case][wiki-snake-case].
8586

@@ -777,4 +778,5 @@ defining dynamic data models.
777778
[ref-polymorphism]: /product/data-modeling/concepts/polymorphic-cubes
778779
[ref-data-blending]: /product/data-modeling/concepts/data-blending
779780
[link-js-template-literals]: https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/Strings#embedding_javascript
780-
[link-python-reserved-words]: https://docs.python.org/3/reference/lexical_analysis.html#keywords
781+
[link-python-reserved-words]: https://docs.python.org/3/reference/lexical_analysis.html#keywords
782+
[ref-dax-api-date-hierarchies]: /product/apis-integrations/dax-api#date-hierarchies

docs/pages/reference/data-model/types-and-formats.mdx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,6 @@ In order to be able to work with time series data, Cube needs to identify
576576
a time dimension which is a timestamp column in your database. You can define
577577
several time dimensions in a single cube.
578578

579-
Note that the type of the target column should be `TIMESTAMP`.
580-
If your time-based column is type `DATE` or another temporal type,
581-
you should cast it to a timestamp in the `sql` parameter of the dimension. Please see
582-
[this recipe][ref-string-time-dims] if your datetime information is stored
583-
as a string.
584-
585579
<CodeTabs>
586580

587581
```javascript
@@ -610,6 +604,17 @@ cubes:
610604
611605
</CodeTabs>
612606
607+
Note that the type of the target column should be `TIMESTAMP`.
608+
If your time-based column is type `DATE` or another temporal type,
609+
you should cast it to a timestamp in the `sql` parameter of the dimension.
610+
611+
<ReferenceBox>
612+
613+
Please see [this recipe][ref-string-time-dims] if your datetime information is stored
614+
as a string.
615+
616+
</ReferenceBox>
617+
613618
### `string`
614619

615620
`string` is typically used with fields that contain letters or special

0 commit comments

Comments
 (0)