📜  Excel DAX-筛选器功能

📅  最后修改于: 2020-12-01 04:50:11             🧑  作者: Mango


DAX具有强大的筛选器功能,与Excel函数完全不同。查找功能通过使用表和关系(例如数据库)来工作。过滤功能使您可以操纵数据上下文以创建动态计算。

–返回表的DAX筛选器函数不会将该表添加到数据模型中。结果表用作另一个DAX函数的参数。即,这种DAX函数与其他DAX函数一起用作嵌套函数。

在下一部分中,您将学习可以使用的DAX过滤器功能。有关这些功能的更多详细信息,请参阅本教程库中的教程– DAX功能。

DAX过滤器功能

以下是DAX筛选器功能-

Sr.No. DAX Function & What the Function Does?
1

ADDMISSINGITEMS (, [] …,

, , [] …, [filterTable] …)

Adds combinations of items from multiple columns to a table if they do not already exist. The determination of which item combinations to add is based on referencing source columns which contain all the possible values for the columns.

To determine the combinations of items from different columns to evaluate −

  • AutoExist is applied for columns within the same table.
  • CrossJoin is applied across different tables.
2

ALL ( {

| , [], [], … })

Returns all the rows in the given table or all the values in the specified columns in a table, ignoring any filters that might have been applied.

This function is useful for clearing filters and creating calculations on all the rows in a table.

3

ALLEXCEPT (

, , [], …)

Removes all context filters in the table except filters that have been applied to the columns specified as arguments.

As against ALL, you can use this function when you want to remove the filters on many, but not all, columns in a table.

4

ALLNOBLANKROW (

|)

From the parent table of a relationship, returns −

  • all rows but the blank rows, or
  • all distinct values of a column but the blank rows

The function disregards any context filters that might exist.

5

ALLSELECTED ( [|] )

Removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters.

6

CALCULATE (, [, …)]

Evaluates an expression in a context that is modified by the specified filters.

Returns the value that is the result of the expression.

7

CALCULATETABLE (, , , …)

Evaluates a table expression in a context modified by the given filters.

Returns a table of values.

8

CROSSFILTER (, , )

Specifies the cross-filtering direction to be used in a calculation for a relationship that exists between two columns. Does not return any value.

9

DISTINCT ()

Returns a one-column table that contains the distinct values from the specified column. In other words, duplicate values are removed and only unique values are returned.

The resulting column is used as an argument in another DAX function.

10

EARLIER (, )

Returns the current value of the specified column in an outer evaluation pass of the mentioned column specified by the number.

11

EARLIEST ()

Returns the current value of the specified column in an outer evaluation pass of the specified column.

12

FILTER (

, )

Returns a table that contains only the filtered rows.

FILTER is used only as a function that is embedded in other functions that require a table as an argument.

13

FILTERS ()

Returns the values that are directly applied as filters to columnName.

FILTERS is used only as a function that is embedded in other functions that require a table as an argument.

14

HASONEFILTER ()

Returns TRUE when the number of directly filtered values on columnName is one. Otherwise, returns FALSE.

15

HASONEVALUE ()

Returns TRUE when the context for columnName has been filtered down to one distinct value only. Otherwise, returns FALSE.

16

ISCROSSFILTERED ()

Returns TRUE when columnName or another column in the same or related table is being filtered.

17

ISFILTERED ()

Returns TRUE when columnName is being filtered directly. If there is no filter on the column or if the filtering happens because a different column in the same table or in a related table is being filtered, then the function returns FALSE.

18

KEEPFILTERS ()

Modifies how filters are applied while evaluating a CALCULATE or CALCULATETABLE function.

19

RELATED ()

Returns a related value from another table.

20

RELATEDTABLE ()

Evaluates a table expression in a context modified by the given filters.

21

SUBSTITUTEWITHINDEX (

, , , , [])

Returns a table which represents a left semijoin of the two tables supplied as arguments.

The semijoin is performed by using common columns, determined by common column names and common data type.

The columns being joined on are replaced with a single column in the returned table which is of type integer and contains an index.

The index is a reference into the right join table given a specified sort order.

22

USERELATIONSHIP ( ,)

Specifies the relationship to be used in a specific calculation as the one that exists between columnName1 and columnName2.

23

VALUES ()

Returns a one-column table that contains the distinct values from the specified table or column.

In other words, duplicate values are removed and only unique values are returned.