Forum Discussion

seikenbary's avatar
seikenbary
Regular Visitor
6 years ago
Solved

How to replace values using column names ?

I am trying to convert the first table to the second table below. my reporting spits out duplicate rows for project for each individual on a project. If you pivot the person column, you can get a sin...
  • Jimmy801's avatar
    6 years ago

    Hello seikenbary 

     

    just use Table.Group with Text.Combine if you want to have in power query. Otherwise use the syntax by az38 

    let
    	Source = #table
    	(
    		{"Project","Person"},
    		{
    			{"A","Art"},	{"A","Bart"},	{"B","Tim"},	{"C","Sue"},	{"D","Larry"},	{"D","Barry"},	{"D","Garry"}
    		}
    	),
        Group = Table.Group(Source, {"Project"}, {{"TextCombine", each Text.Combine(_[Person], ", "), type text}})
    in
    	Group

    Copy paste this code to the advanced editor to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query, or I could create a custom function what makes it easier to apply if you are not used that much to power query.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy