PowerApps 中的 Distinct 函数Distinct function in PowerApps

中的记录进行汇总,并删除重复项。Summarizes records of a table, removing duplicates.

说明Description

Distinct 函数对表中的各条记录进行公式求值。The Distinct function evaluates a formula across each record of a table. Distinct 返回一个包含结果的单列表,其中删除了重复项。Distinct returns a one-column table that contains the results, with duplicate values removed.

当前正在处理的记录字段在该公式中可用。Fields of the record currently being processed are available within the formula. 只需按名称对其引用,这与引用任何其他值的方法相同。You simply reference them by name as you would any other value. 另外,也可以从整个应用中引用控件属性和其他值。You can also reference control properties and other values from throughout your app. 有关详细信息,请参阅下面的示例和使用记录作用域For more details, see the examples below and working with record scope.

语法Syntax

Distinct( Table, Formula )Distinct( Table, Formula )

  • Table - 必需。Table - Required. 要对其进行求值的表。Table to evaluate across.
  • Formula - 必需。Formula - Required. 用于对每条记录求值的公式。Formula to evaluate for each record.

示例Example

如果 Employees 表中包含 Department 列,无论每个部门名称在表中出现多少次,以下函数都会在该列中列出每个唯一部门名称:If you had an Employees table that contained a Department column, this function would list each unique department name in that column, no matter how many times each name appeared in that column:

Distinct(Employees, Department)Distinct(Employees, Department)