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:
flexyourdata
Jul 29, 2023Iron Contributor
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
Result
This will result in a summary table as shown in green:
- shouronpouJul 30, 2023Copper Contributorflexyourdata
Thank you so much for your suggestion! This helps me a lot.