Forum Discussion
Help with a table visualization
- 10 years ago
List.Distinct will do that:
let Source = Ressource, GroupRows = Table.Group(Source, {"ProjectName"}, {{"ResourceName", each _, type table}, {"SumTimesheetActualWork", each List.Sum([#"TimesheetActualWork"]), type number}}), TransformColumnToText = Table.AddColumn(GroupRows, "Custom", each Text.Combine(List.Distinct([ResourceName][ResourceName]), ", ")), Cleanup = Table.RemoveColumns(TransformColumnToText,{"ResourceName"}) in Cleanup
ImkeF I managed to create a connection between the two tables and now my data is more clean and simple. I had a blank row in one of the tables that I hadn't noticed.
A problem that I noticed though is with the code you provided at your first post.
let
Source = Ressource,
GroupRows = Table.Group(Source, {"ProjectName"}, {{"ResourceName", each _, type table}, {"SumTimesheetActualWork", each List.Sum([#"TimesheetActualWork"]), type number}}),
TransformColumnToText = Table.AddColumn(GroupRows, "Custom", each Text.Combine([ResourceName][ResourceName], ", ")),
Cleanup = Table.RemoveColumns(TransformColumnToText,{"ResourceName"})
in
Cleanup
It looks like it's working fine but after using it on visualizations I get the names of my resources mulitiple times in a cell.
This is happening because of the format of my table.
ProjectName ResourceName TimesheetActualWork Week
a John 8 1
a John 5 2
a George 8 1
b John 3 2
b George 8 2
using the code you provided i.e. for project a i get the name John twice. and my final table looks something like this:
ProjectName SumTimesheetActualWork Resources
a 21 John, John, George
b 11 John, George
Is there a way to remove duplicates?
List.Distinct will do that:
let
Source = Ressource,
GroupRows = Table.Group(Source, {"ProjectName"}, {{"ResourceName", each _, type table}, {"SumTimesheetActualWork", each List.Sum([#"TimesheetActualWork"]), type number}}),
TransformColumnToText = Table.AddColumn(GroupRows, "Custom", each Text.Combine(List.Distinct([ResourceName][ResourceName]), ", ")),
Cleanup = Table.RemoveColumns(TransformColumnToText,{"ResourceName"})
in
Cleanup