You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _mydocs/dax-style/dax-naming-conventions.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,38 @@
1
1
---
2
2
layout: page
3
-
title: DAX naming conventions
3
+
title: DAX Naming Conventions
4
4
published: true
5
5
order: /
6
6
---
7
7
8
8
The naming conventions for DAX coding in reality involve many objects of the semantic model and reflect the need of exposing clear names to the user and to keep the code readable and maintainable. The following sections describe the conventions for the main DAX and semantic model objects.
9
9
10
-
# Golden rules for all objects
10
+
##Golden rules for all objects
11
11
- All names should be written using names that are clear for the business users and understandable in the reports.
12
12
- Avoid using abbreviations or acronyms unless they are widely recognized and understood by the business users.
13
13
14
-
# Tables
14
+
##Tables
15
15
- Do not use any technical prefix, like `dim` or `fact`.
16
16
- Use a single noun when possible for a table name.
17
17
- When more words are part of a table name, separate them by using a space if the table may be visible to the users, like `Coupons Orders`.
18
18
- You might use PascalCase (e.g., `PricingConfiguration`) if the table name is designed to be invisible to the user.
19
19
- Use singular nouns for qualitative business entities (e.g., `Customer`, `Product`, `Sales Region`).
20
20
- Use uncountable or plural nouns for quantitative business entities (e.g., `Sales`, `Inventory`, `Revenue`, `Movements`).
21
21
22
-
# Columns
22
+
##Columns
23
23
- Do not use any technical prefix, like `date` or `string`.
24
24
- Use a single noun when possible for a column name.
25
25
- When more words are part of a column name, separate them by using a space if the table may be visible to the users, like `Coupons Orders`.
26
26
- You might use PascalCase (e.g., `PricingConfiguration`) if the column name is designed to be invisible to the user.
27
27
28
-
# Measures
28
+
##Measures
29
29
- The measure name should clearly describe its result.
30
30
- When more words are part of a measure name, separate them by using a space if the measure may be visible to the users, like `Sales Amount`.
31
31
- You might use PascalCase (e.g., `SalesAmount`) if the measure name is designed to be invisible to the user.
32
32
- Consider common acronyms that are widely recognized and understood by the business users, like `ROI` or `YOY`.
33
33
- Use time intelligence acronyms like `YTD`, `QTD`, `MTD`, `PY`, `LY` as a suffix, like `Sales Amount YTD` or `Sales Amount PY`. A common list of time intelligence acronyms is provided below:
34
+
35
+
34
36
| Acronym | Meaning |
35
37
|---------|---------|
36
38
| YTD | Year-to-date |
@@ -60,17 +62,17 @@ The naming conventions for DAX coding in reality involve many objects of the sem
- Define a last variable named Result to hold the final result of the measure or expression.
66
68
- This allows to quickly restore the expression logic when editing it for debugging purposes.
67
69
- You may use a prefix like `_` (underscore) for variable names.
68
70
- While this was required to avoid possible name conflicts in the past, it is no longer necessary.
69
71
- However, it can still be useful to visually distinguish variables from other objects in the code.
70
72
71
-
# User-defined functions
73
+
##User-defined functions
72
74
73
-
## Function names
75
+
###Function names
74
76
- Function names should be written in PascalCase.
75
77
- The dot character (.) is permitted within function names and is recommended for delineating categories.
76
78
- This serves as an effective analogue to namespaces commonly found in many programming languages.
@@ -92,7 +94,7 @@ The naming conventions for DAX coding in reality involve many objects of the sem
92
94
- You cannot use `Dax` as a noun part of the function name, as Microsoft reserves it.
93
95
- You should not use `DaxLib` as an initial prefix for a function name, as it is reserved for general-purpose libraries maintained by the [DAX Lib](https://daxlib.org) community.
94
96
95
-
## Parameters
97
+
###Parameters
96
98
- Use [camelCase](https://en.wikipedia.org/wiki/Camel_case) for parameter names.
97
99
- Include a suffix indicating the parameter type for `EXPR` parameters:
98
100
-`Column` for a column reference.
@@ -105,7 +107,7 @@ As a result, `YearlySales` is interpreted as a variable, whereas `yearlySales` i
105
107
106
108
Examples of `EXPR` parameter names are: `lookupTable`, `listPriceColumn`, `amountMeasure`, `metricExpr`.
107
109
108
-
## Comments
110
+
###Comments
109
111
110
112
Comments describing functions are typically introduced with a triple forward slash (///) directly before the function declaration. This notation serves to document the function’s purpose. For example, the following function converts the temperature from Celsius to Fahrenheit:
0 commit comments