Forum Discussion
DNLAL
3 years agoRegular Visitor
Rows to columns
I know this is a common one ! and lots of questions/videos etc.. however dumb as I am I can't quite hit on the exact steps to do what I need ! I have been unpivoting and pivoting etc.. but haven't m...
- 3 years ago
So in the end I just pivoted on the code column using the value column for the value and that gave me what I needed. Thanks for your help anyway
DNLAL
3 years agoRegular Visitor
Sorry not quite sure what you mean? where do I put that
- jennratten3 years agoSuper User
Select your table in Power Query, click Advanced Editor on the ribbon, copy the script below, add a comma to the last line before the 'in' at the botton, remove the 'in' and the last line, paste the snip at the end. In the Replaced Value step, replace #"Changed Type" with the value that appears before the equals sign in the line above it.
#"Replaced Value" = Table.ReplaceValue(#"Changed Type", each [Code], each "Code " & [Code],Replacer.ReplaceText,{"Code"}), #"Pivoted Column1" = Table.Pivot(#"Replaced Value", List.Distinct(#"Replaced Value"[Code]), "Code", "Value"), #"Replaced Value1" = Table.ReplaceValue(#"Pivoted Column1",null,0,Replacer.ReplaceValue,{"Code I", "Code Z", "Code A"}) in #"Replaced Value1"