Dec 22 2023 10:21 PM
Hello my friends
I want in power query to remove the repeated rows and transpose the invoices like i showed in excel file ,
thank you fry your help
Dec 22 2023 10:49 PM
Solution@Jalal_1988 I trust you have a good reason for wanting to do this, since the data is already very well structured as it is. One would normally want to go from the 'transposed' data towards data in a tabular form. But that's your choice.
See attached.
Dec 23 2023 12:37 AM
Dec 23 2023 12:48 AM - edited Dec 23 2023 12:49 AM
@Jalal_1988 What do you mean? You ask for a PQ solution. You get one that is very basic. What other 'easy' solution do you want?
Dec 23 2023 12:56 AM
Dec 23 2023 01:33 AM
@Jalal_1988 Can't think of an easier solution right now.
Dec 23 2023 01:58 AM
Dec 23 2023 02:31 AM
1) Connect to the data range
2) Promote headers
3) Group by CODE and Name. I chose 'Sum by INVOICE' first. That creates an error as you can't sum texts. But it gives you 90% of the M-code needed.
4) Manually change the initial code for the "Grouped Rows" step into:
5) Add an index column to number the two rows and sort/reorder the columns as you like.
Dec 23 2023 06:33 PM
sql:
//select * from basic_group_concat limit 20;
select row_number() over () NO,CODE,NAME,group_concat(INVOCIE,'</td><td>') INVOCIE from basic_group_concat group by CODE,NAME
Dec 22 2023 10:49 PM
Solution@Jalal_1988 I trust you have a good reason for wanting to do this, since the data is already very well structured as it is. One would normally want to go from the 'transposed' data towards data in a tabular form. But that's your choice.
See attached.