0
votes

I have rows of data in Power BI, each row has a duplicate row which has different numerical values. I want to add each row with the duplicate and make it appear as 1 row.

Please how can I solve this.

2
How you can distinguish the first row from the second? Which row values should go to the additional columns?Andrey Nikolov

2 Answers

0
votes

Suppose, you have such table:

enter image description here

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:

enter image description here

If you need to keep order of rows, just add index column before grouping, then sort it after combine step.

0
votes

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.