Power Query General Question

mduntley

Board Regular
Joined
May 23, 2015
Messages
139
Office Version
  1. 365
Platform
  1. Windows
Is it possible to delete a column, and then after insert it back in? I need to do some formating in a column
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Do you mean from the source data, or within your query?
 
Upvote 0
I don’t really understand why you would need to do that?
 
Upvote 0
Ok, here is a example. I am trying to get all unique value in column 2. How i am going to do it right now is to create a new table, only have column 2, split them in different rows, remove duplicate, combine them into one cell and then merge them into my original table. I am wondering if there is a easier way to do it.l

Power Query:
let
    Source = #table({"Column1", "Column2", "Column3"}, {{"Fruit","Apple","Market"},{"Fruit","Orange","Store"},{"Fruit","Orange",null},{"Fruit","Banana",null},{"Fruit","Orange",null},{"Fruit","Berries",null}}),
    #"Grouped Rows" = Table.Group(Source, {"Column1"}, {{"Count", each _, type table}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Text.Combine([Count][Column2],"#(lf)")),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Text.Combine([Count][Column3],"#(lf)")),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Count"})
in
    #"Removed Columns"

This is my table i have right now

Book1
ABC
1Column1CustomCustom.1
2FruitApple Orange Orange Banana Orange BerriesMarket Store
Sheet2


I want to get this

Book1
ABC
1Column1CustomCustom.1
2FruitApple Orange Banana BerriesMarket Store
Sheet2
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    tbl = Table.TransformColumns(Source, {"Custom", each Text.Combine(List.Distinct(Text.Split(_, "#(lf)")), "#(lf)")})
in
    tbl
 
Upvote 0

Forum statistics

Threads
1,223,391
Messages
6,171,817
Members
452,426
Latest member
cmachael

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top