计算 PowerApps 集合中出现的次数

问题描述 投票:0回答:2

我正在尝试计算 PowerApps 集合中每个项目的出现次数。

SharePoint 列表名称:产品

想要的结果

Fruit    Number of Occurrences
Apple            1
Orange           1
Apple            2
Banana           1
Orange           2
Apple            3
Banana           2
Banana           3
Watermelon       1
Apple            4
collections powerapps powerapps-collection
2个回答
0
投票

使用

GroupBy
Fruit
AddColumns
进行分组以添加新列来存储组计数。

假设您计划在 Vertical Gallery 中显示上述内容,您可以在 Items 属性中使用此公式:

AddColumns(GroupBy(Product, "Fruit", "Grouped"), "FruitCount", CountRows(Grouped))

请参阅下面的屏幕截图。我使用“部门”而不是“水果”,但概念是相同的。


0
投票

尽管这可能不是肯德尔想要的……谢谢,这真的很有用。

然后,您还可以按计数对画廊进行排序,在下面的情况下,按降序排列。 SortByColumns(AddColumns(GroupBy(产品, "水果", "分组"), "水果计数", CountRows(分组)),"水果计数",SortOrder.降序)

© www.soinside.com 2019 - 2024. All rights reserved.