Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Group column then comma-separate the rest

I have the following dataset:

https://i.ibb.co/3h3mzrN/Capture.png

 

I just want to group rows that have the same ComputerID, then comma-separate the other columns (But without duplicates in the comma-separated lists (a.k.a. "distinct" values)):

 

ComputerIDGroupedKBID
224603003
674538461
3594535105, 982861, 4536953, 4520002

 

I tried following this step-by-step picture tutorial on Stackoverflow:

https://stackoverflow.com/questions/64262999/need-a-comma-separated-group-by-in-powerbi

 

...but the data errors out (Removing Errors deletes all the rows):

https://i.ibb.co/ykxFgp3/Capture2.png

 

Full Power Query:

 

let
Source = MySQL.Database("MyServer", "MyDatabase", [ReturnSingleDatabase=true, Query="Select UUID() AS id, cl.name as Client, c.ComputerID, d.Name, c.OS, c.Title, c.KBID,
SuccessCount, NotAttemptedCount, FailedCount, Compliance, Last_Updated, c.Hotfixid, h.date_added, DATEDIFF(CURDATE(),h.date_added) as Age,
e.Approved, h.severity, d.UpTime, f.spare, f.`AD Computer Last Logon`, IF(d.lastcontact > (NOW() - INTERVAL 15 MINUTE), 1, 0) AS 'Online'
From hotfixcompliancedata c
JOIN computers d on d.ComputerID= c.ComputerID
JOIN clients cl on cl.clientid= d.clientid
JOIN hotfixdata h on h.hotfixid= c.hotfixid
JOIN hotfix e on e.hotfixid= c.hotfixid
JOIN v_extradatacomputers f on f.computerid= c.computerid
WHERE DATEDIFF(CURDATE(),h.date_added)>30 and compliance<100 and e.approved=2
GROUP BY c.KBID"]),
#"Removed Columns" = Table.RemoveColumns(Source,{"id", "Client", "Name", "OS", "Title", "SuccessCount", "NotAttemptedCount", "FailedCount", "Compliance", "Last_Updated", "Hotfixid", "date_added", "Age", "Approved", "severity", "UpTime", "spare", "AD Computer Last Logon", "Online"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"ComputerID"}, {{"GroupedKBID", each _, type table [ComputerID=number, KBID=text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [GroupedKBID][Value])
in
#"Added Custom"

 

 

I also struggled to manually incorporate the Power Query answers here into my own dataset:

https://community.powerbi.com/t5/Desktop/group-by-a-column-and-the-group-item-to-be-shown-in-comma/m...

https://community.powerbi.com/t5/Desktop/Help-with-a-table-visualization/td-p/24143/page/2

 

Could someone help me group rows by a column, then comma-separate (distinctly) the rest of the columns?

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

[Value] is not one of your columns, so [GroupedKBID][Value] doesn't make sense. Try [GroupedKBID][KBID] instead.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

[Value] is not one of your columns, so [GroupedKBID][Value] doesn't make sense. Try [GroupedKBID][KBID] instead.

Anonymous
Not applicable

Oh thanks! The StackOverflow example had a column name called "Value", but that's also a generic PowerBI variable name ( https://i.ibb.co/6gw8BZC/Capture.png ), thus the StackOverflow answer misled me a bit. I appreciate the nudge in the right direction

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.