Dax Functions 简明教程
DAX Functions - Description Structure
如果您需要在 DAX 公式中使用 DAX 函数,那么您需要详细地了解该函数。您应当了解该函数的语法、参数类型、该函数返回的内容,等等。
If you have to use a DAX function in a DAX formula, you need to understand the function in detail. You should know the syntax of the function, the parameter types, what the function returns, etc.
为方便您理解如何阅读和解释 DAX 函数,本教程采用了统一的函数描述结构。
To enable you to understand how to read and interpret the DAX functions, a uniform function description structure is used in this tutorial.
-
The different types of DAX functions are grouped by the type name of the DAX functions as chapters.
-
Each of these chapters provides a brief description of the utility of the respective type of DAX functions.
-
The brief description will be followed by the list of DAX functions corresponding to that chapter (Type/Category of DAX functions).
-
Each DAX function name is hyperlinked to DAX function details that have the following DAX function description structure − DescriptionSyntaxParametersReturn ValueRemarksExample
以下部分说明每个 DAX 函数说明中出现的各个标题。
The following sections explain each of these headings that appear in each DAX function explanation.
Description
在说明部分,您将学习 DAX 函数是什么以及它可以在哪里使用。
In the Description section, you will learn what the DAX function is about and where it can be used.
如果 DAX 函数是在 Excel 2016 中引入的,这里也会提到。(其他 DAX 函数存在于 Excel 2013 中。)
If the DAX function is introduced in Excel 2016, the same will be mentioned here. (Rest of the DAX functions exist in Excel 2013.)
Syntax
在语法部分,你将了解确切的功能名称和相关参数。
In the Syntax section, you will learn the exact function name and the respective parameters.
-
DAX function name is given in UPPERCASE letters.
-
DAX function name is followed by opening parenthesis.
-
Each parameter follows standard DAX parameter naming convention and is enclosed in angle brackets.
-
If a parameter is optional, it is further enclosed in square brackets.
-
The parameters are separated by commas.
-
Ellipses … are used to show an optional number of repetitions of parameters.
-
The function syntax ends with closing parenthesis.
Parameters
在“参数”段中,特定 DAX 函数的每个参数在具有其说明的表中列出。例如,上述示例 DAX 函数 SELECTCOLUMNS 的参数列在下面的表中。
In the Parameters section, each of the parameters of the specific DAX function is listed in a table with its description. For example, the parameters of the above example DAX function SELECTCOLUMNS is listed in the following table.
Sr.No. |
Parameter & Description |
1 |
Table Table or a DAX expression that returns a table. |
2 |
Name The name given to the column, enclosed in double quotes. |
3 |
scalar_expression DAX expression that returns a scalar value like a column reference, integer, or string value. |
Return Value
在“返回值”部分,您将了解 DAX 函数将返回什么值及其数据类型。
In the Return Value section, you will learn about what value the DAX function will return and its data type.
Remarks
在“备注”部分,您将了解有关 DAX 函数用法的任何额外信息。您还将了解潜在错误及原因。
In the Remarks section, you will learn about any extra information that you need to know about the usage of the DAX function. You will also understand the potential errors and the reasons.
Example
本部分提供了 DAX 函数用法示例。
An example of the usage of the DAX function is given in this section.
Note − 当您编写具有参数数据值的 DAX 函数时,您将按照以下给出的命名约定 −
Note − When you write DAX functions with the data values for the parameters, you will follow the naming conventions as given below −
-
A Table name is specified as it appears in the Data Model. E.g. Sales.
-
A Column name is specified as it appears in the Data Model with square brackets enclosing it. For example, [Sales Amount] It is recommended to use fully qualified names for columns, i.e. a column name is prefixed with the table name that contains it. For example, Sales[Sales Amount] If the table name contains spaces, it should be enclosed in single quotes. For example, ‘East Sales’[Sales Amount]
-
A DAX function can return a column or table of values, in which case, it needs to be used as a parameter of another DAX function that requires a column or table.