简体   繁体   English

如何在 Power BI 或 Power query 中操作数据行

[英]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.

相关问题 如何在 power bi/power 查询中动态地将行添加到列 - How to dynamically add rows to column in power bi/power query 汇总数据时如何在 Power Query / Power BI 的记录集中创建零计数行 - How to create zero-count rows in recordset in Power Query / Power BI when summarizing data 如何根据 Power Query 中 Power BI 参数中逗号分隔的值列表删除行? - How do i remove rows based on comma-separated list of values in a Power BI parameter in Power Query? 如何在 SQL 查询中引用 Power BI 度量? - How can I reference a Power BI measure in a SQL query? Power BI REST API Power Query/Power BI 中的使用数据 - Power BI REST API Usage data in Power Query/Power BI 从 excel 到 Power BI 到 Power Query:如何让用户更轻松地更新查询 - From excel to Power BI to Power Query: how can I make it easier for a user to update a query 如何通过每天更新的不同查询在 Power BI 中创建新的数据表? - How can I create a new table of data in Power BI from a different query that updates daily? 如何在 Power Query / Power BI 的列中插入缺失值? - How can I interpolate missing values in a column in Power Query / Power BI? 如何在Power BI中轻松标记数据? - How can I easily label my data in Power BI? Power Bi中的数据存储查询 - Data storage query in Power Bi
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM