Dax Functions 简明教程
DAX Parameter Naming Conventions
DAX 拥有标准的参数名称来帮助使用和理解 DAX 函数。此外,您可以在参数名前使用特定前缀。如果前缀清晰易懂,您可以使用前缀本身作为参数名。
DAX has standard parameter names to facilitate the usage and understanding of the DAX functions. Further, you can use certain prefixes to the parameter names. If the prefix is clear enough, you can use the prefix itself as the parameter name.
在理解 DAX 函数的语法并正确使用数据值来获取相关的 DAX 函数参数之前,您需要理解 DAX 参数的命名规则。
To understand the syntax of the DAX functions and to use data values appropriately for the relevant DAX function parameters, you need to understand DAX parameter naming conventions.
Parameter Names
以下为 DAX 的标准参数名称:
Following are the DAX standard parameter names −
Sr.No. |
Parameter Name & Description |
1 |
expression Any DAX expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context). |
2 |
value Any DAX expression that returns a single scalar value where the expression is to be evaluated exactly once before all other operations. |
3 |
table Any DAX expression that returns a table of data. |
4 |
tableName The name of an existing table using standard DAX syntax. It cannot be an expression. |
5 |
columnName The name of an existing column using standard DAX syntax, usually fully qualified. It cannot be an expression. |
6 |
name A string constant that will be used to provide the name of a new object. |
7 |
order An enumeration used to determine the sort order. |
8 |
ties An enumeration used to determine the handling of tie values. |
9 |
type An enumeration used to determine the data type for PathItem and PathItemReverse. |
Prefixing Parameter Names or Using the Prefix Only
您可以用前缀来限定参数名称:
You can qualify a parameter name with a prefix −
-
The prefix should be descriptive of how the argument is used.
-
The prefix should be in such a way that ambiguous reading of the parameter is avoided.
例如,
For example,
-
Result_ColumnName − Refers to an existing column used to get the result values in the DAX LOOKUPVALUE () function.
-
Search_ColumnName − Refers to an existing column used to search for a value in the DAX LOOKUPVALUE () function.
如果前缀足够明确地描述参数,你就可以省略参数名称而仅使用前缀。有时,省略参数名称且仅使用前缀有助于避免在阅读期间产生杂乱。
You can omit the parameter name and use only the prefix, if the prefix is clear enough to describe the parameter. Omitting the parameter name and using only prefix can sometimes help in avoiding the clutter during reading.
例如,考虑 DATE (Year_value, Month_value, Day_value) 。你可以省略参数名称 - value(重复三次),并将其写为 DATE (Year, Month, Day)。正如所见,仅通过使用前缀,函数就更具可读性。但是,有时为了更清楚地理解,参数名称和前缀必须同时存在。
For example, Consider DATE (Year_value, Month_value, Day_value). You can omit the parameter name – value, that is repeated thrice and write it as DATE (Year, Month, Day). As seen, by using only the prefixes, the function is more readable. However, sometimes the parameter name and the prefix have to be present for clarity.
例如,考虑 Year_columnName 。参数名称是 ColumnName,前缀是 Year。两者同时存在是为了让用户理解此参数需要现有年份列的引用。
For example, Consider Year_columnName. The parameter name is ColumnName and the prefix is Year. Both are required to make the user understand that the parameter requires a reference to an existing column of years.