Forum Discussion
Merge only differences in the rows in a power query
- 2 years ago
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
- 2 years ago
pls try another variant
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
- kmilarov2 years ago
Helper II
Thank you, Ahmedx. I am trying to implement the formula/steps with the real complex file. Could you advise at what step did you create and insert the trans formula ? I am entering it within the table , but When creating it - I got and error:
An error occurred in the ‘Table’ query. Expression.Error: We cannot convert a value of type Function to type Table.
Details:
Value=[Function]
Type=[Type]- kmilarov2 years ago
Helper II
disregard this. I managed to fix it as per your pbix file. It works now very well. Thank you!
- kmilarov2 years ago
Helper II
Ahmedx Hi, I mentioned that the formula merges only the first two rows. But sometimes we have 3-4-5 rows with the same TagID. Can I emend the formula adding column3, 4 etc? or somehow to calculate the number of the required columns first and to merge them based on this? Irevised the example excel file adding third row with TagID 12 for example
= (x)=> [
t1 = Table.Transpose(Table.DemoteHeaders(x)),
t2 = Table.AddColumn(t1, "Custom", each if [Column1] = "Element:Text" then [Column2] else if [Column2]=[Column3] then [Column2] else Text.From( [Column2]) & " /// " & Text.From( [Column3]))[[Column1],[Custom]],
Results =Table.PromoteHeaders( Table.Transpose(t2), [PromoteAllScalars=true])][Results]