Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have the following data that is grouped:
Area Domain Sub-Domain TeamMember
A B C John
A B C Tom
A D F Sue
A D F Mary
A E L Frank
I need to concat the last column and collape the table to look like
Area Domain Sub-Domain TeamMember
A B C John / Tom
A D F Sue / Mary
A E L Frank
Any way to get this alike ?
Thank you, @ToddChitt , @MasonMA , and @Omid_Motamedise , for your responses.
Hi @EaglesTony,
We appreciate your inquiry raised through the Microsoft Fabric Community Forum.
We would like to follow up to know if you have had the opportunity to review the solutions provided by @MasonMA, @Omid_Motamedise to address the issue. We hope that the information shared will assist in resolving your query.
Should you have any further questions or require additional assistance, please do not hesitate to reach out to the Microsoft Fabric Community.
Thank you.
Hi @EaglesTony
just copy the following code and paste it into the Advanced editor
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcjy0QElH6dACJyjtDKa98jPylGJ1cEmH5OeiyLpAaTcwHVyaikfWN7GoEkXaFUz7gEm3osS8bKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Area " = _t, #"Domain " = _t, #"Sub-Domain " = _t, TeamMember = _t]),
#"Grouped Rows" = Table.Group(Source, {"Area ", "Domain ", "Sub-Domain "}, {{"Team members", each Text.Combine([#"TeamMember"]," / "), type nullable text}})
in
#"Grouped Rows"
Hi @EaglesTony
I'd recommend leveraging UI as much as you can and only coding wherever not possible with UI. For this You can use UI to Group by first 3 Columns and have UI generate the M code, then with some modification on the code to concatenate the Names.
The UI will generate M code below
= Table.Group(Source, {"Area", "Domain", "Sub-Domain"}, {{"teamMembers", each _, type table [Area=text, Domain=text, #"Sub-Domain"=text, TeamMember=text]}})
then Replace the part
{{"teamMembers", each _, type table [Area=text, Domain=text, #"Sub-Domain"=text, TeamMember=text]}}
with below M code to concatenate those names.
{{"TeamMembers", each Text.Combine([TeamMember], " / "), type text}}
Hope this helps:)
What is the MAX number of names you might come across for any one group? two? ten? one hundred? If known and manageable, you could pivot (or unpivot, i never remember which does which) so you get a column for each row in Team Member column. Then create a calculated column that concatenates all the values.
Yoiu will need to put in some logic to not leave trailing slashes if it has less than the max number of members.
Proud to be a Super User! | |
There is no max.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
6 | |
6 | |
6 | |
6 |
User | Count |
---|---|
9 | |
9 | |
8 | |
6 | |
6 |