Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I have a simple list with text objects.
Example:
rowHeader |
Apples |
Oranges |
Bananas |
Kiwis |
Plums |
Grapes |
Tomatos |
I am wondering if there is a way to combine every X rows. For example, I want to combine every 3 rows in to a single row with some string tagged on (like. "Object(s): "), and delimited by a comma (","), so it would look like:
rowHeader2 |
Object(s): Apples,Oranges,Bananas |
Object(s): Kiwis,Plums,Grapes |
Object(s): Tomatos |
The out-of-the-box functions from what I see can only do static merges of 2 or more colums, but the list I actually have has 100+ rows.
Solved! Go to Solution.
Hi , @meforwork
According to your description, you want to combine every 3 rows in to a single row.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can insert a step after the "Changed Type" step, and we can enter this M code in it :
= List.Transform(List.Generate(()=>0,each _<=List.Count(#"Changed Type"[rowHeader]),each _+3,each List.Range( #"Changed Type"[rowHeader],_,3)), (x)=>"Object(s):" & Text.Combine(x,",") )
If the above step's name is not the #"Changed Type", you need to change the M code in your side.
And then we can get the result as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @meforwork
According to your description, you want to combine every 3 rows in to a single row.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can insert a step after the "Changed Type" step, and we can enter this M code in it :
= List.Transform(List.Generate(()=>0,each _<=List.Count(#"Changed Type"[rowHeader]),each _+3,each List.Range( #"Changed Type"[rowHeader],_,3)), (x)=>"Object(s):" & Text.Combine(x,",") )
If the above step's name is not the #"Changed Type", you need to change the M code in your side.
And then we can get the result as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@meforwork , add an index column starting with 0 in the power query
then add a new column in the power query
Power BI- Power Query Table.AddIndexColumn- https://youtu.be/KEW4bbuqbV8
Number.IntegerDivide([Index],3)
Now use group by and concat as given in the video
Concatenate Text- Measure, DAX Table, and Power Query Table: https://youtu.be/xAh3tz1qo24
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
96 | |
92 | |
87 | |
69 |
User | Count |
---|---|
161 | |
126 | |
119 | |
109 | |
95 |