Forum Discussion
shouronpou
Jul 29, 2023Copper Contributor
A Question about Power Query
I am making a task management chart using Excel. The chart has a detail sheet and a summary sheet. The detail sheet has columns for major category tasks, minor category tasks, and progress. The detai...
- Jul 29, 2023
You can use this query:
let Source = Excel.CurrentWorkbook(){[Name="Detail"]}[Content], // Group by Major Tasks, return a list column called Progress containing the Progress values for that major task Groups = Table.Group(Source, {"Major Tasks"}, {{"Progress", each _[Progress]}}), /* Add a column that counts the distinct Progress values for each major task If the count is greater than 1, return "In progress" Otherwise the count is 1, return the first item (they're all the same)*/ Result = Table.AddColumn(Groups, "Status", each if List.Count( List.Distinct(_[Progress]) )>1 then "In Progress" else _[Progress]{0} )[[Major Tasks], [Status]] in ResultThis will result in a summary table as shown in green:
Lorenzo
Jul 30, 2023Silver Contributor
Similarly
let
Source = Excel.CurrentWorkbook(){[Name="TableDetails"]}[Content],
GroupedRows = Table.Group(Source, {"Major tasks"},
{"Progress", (t)=>
if Table.RowCount(Table.Distinct(t, {"Progress"})) > 1
then "In Progress"
else Table.First(t)[Progress]
}
)
in
GroupedRowsshouronpou
Jul 30, 2023Copper Contributor
Lorenzo
Thank you so much for your advice! It helped me a lot.
Thank you so much for your advice! It helped me a lot.
- LorenzoJul 31, 2023Silver Contributor
You're welcome & Thanks for posting back