循环利用Power Query / DAX / Power BI中每个实体的前10名

我有一个像。的要求,

一个来源和10个实体我需要每个实体10个运行数据。

例如。,

Source1 Entity1 ( top 10 ) Source1 Entity2 ( top 10) .... ... Source1 Entity10 ( top 10) 

我正在尝试使用Power BI来完成这个任务。 我有200个logging的整个数据,但是当我sorting与前10名的每个实体时,我必须能够得到只有100个logging。 如何在DAX或Power Query中执行此操作

提前Thankanks。

在Power Query中,您可以使用“All Rows”操作符在实体上进行分组,添加一个自定义步骤(下面的“Max10Runs”)以select前10位,然后使用嵌套表(仅字段“运行”)展开该列。

 let Source = Source, #"Grouped Rows" = Table.Group(Source, {"Entity"}, {{"AllData", each _, type table}}), Max10Runs = Table.TransformColumns(#"Grouped Rows",{{"AllData", each Table.MaxN(_, each [Runs], 10)}}), #"Expanded AllData" = Table.ExpandTableColumn(Max10Runs, "AllData", {"Runs"}, {"Runs"}) in #"Expanded AllData"