[英]How can i manipulate rows of data in Power BI or Power query
I have rows of data in Power BI, each row has a duplicate row which has different numerical values.我在 Power BI 中有几行数据,每一行都有一个重复的行,该行具有不同的数值。 I want to add each row with the duplicate and make it appear as 1 row.我想用重复项添加每一行并使其显示为 1 行。
Please how can I solve this.请问我该如何解决这个问题。
Suppose, you have such table:假设,你有这样的表:
Then you may use following code:那么你可以使用以下代码:
let
Source = Excel.CurrentWorkbook(){[Name="Table"]}[Content],
group = Table.Group(Source, {"col1", "col2"}, {"temp", each let x = [col3]{0} in Table.TransformColumns(_, {"col3", each x})}),
combine = Table.Combine(group[temp])
in
combine
to get this result:得到这个结果:
If you need to keep order of rows, just add index column before grouping, then sort it after combine step.如果您需要保持行的顺序,只需在分组前添加索引列,然后在组合步骤后对其进行排序。
I am not entirely sure what you are looking for, but it looks pretty close to the group by operation.我不完全确定你在寻找什么,但它看起来非常接近操作组。 You can group up values in the "Transform" tab under "Edit Query".您可以在“编辑查询”下的“转换”选项卡中对值进行分组。 Once you get to the Transform tab, select "Group By" and choose the desired criteria.进入“转换”选项卡后,选择“分组依据”并选择所需的条件。 This will let you group up the values and sum the numerical values.这将让您对值进行分组并对数值求和。 Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.