Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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)):
ComputerID | GroupedKBID |
22 | 4603003 |
67 | 4538461 |
359 | 4535105, 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/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?
Solved! Go to Solution.
[Value] is not one of your columns, so [GroupedKBID][Value] doesn't make sense. Try [GroupedKBID][KBID] instead.
[Value] is not one of your columns, so [GroupedKBID][Value] doesn't make sense. Try [GroupedKBID][KBID] instead.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
146 | |
110 | |
107 | |
86 | |
63 |