Combining Fields with PowerQuery

DavidG007

Board Regular
Joined
Jul 6, 2018
Messages
79
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Just hoping someone maybe able to help, what I am trying to do is;

I currently have two Queries; I need help to be able to 'fix' the data in Query1 and concatenate the data in Query2 as per below.

Query 1Query 2NEW QUERY (Derived)
a1a1
b2a2
3a3
4a4
5a5
b1
b2

etc etc

Can anyone help?

Thanks for anything
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
like this?

p2p.png


Code:
// Query1
let
    Source = {"a","b"},
    C2T = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    C2T

// Query2
let
    Source = {1..5},
    C2T = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    C2T

// Query3
let
    Source = Query1,
    P2P = Table.AddColumn(Source, "Custom", each Query2),
    Expand = Table.ExpandTableColumn(P2P, "Custom", {"Column1"}, {"Column1.1"}),
    Merge = Table.CombineColumns(Table.TransformColumnTypes(Expand, {{"Column1.1", type text}}, "en-GB"),{"Column1", "Column1.1"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged")
in
    Merge
 
Upvote 0
Hi Sandy,

A huge thank you for taking a look at my query, very much appreciated.

Yes, your extract is spot on. I will just see if I can apply your formula,

thanks again
 
Upvote 0
Hi Sandy,

I've been trying to follow your code above but I'm struggling to get it to work.... I don't suppose you could ping over the simple spreadsheet you may have done to test so that I can try and follow?

Thanks again
 
Upvote 0
Hi
Single query for advanced editor
Code:
let
    letters = Table.FromColumns({{"a".."b"}}, {"letter"}),
    numberTexts = Table.FromColumns({{1..5}}, {"number"}),
    cartesian = Table.Join(letters, {}, numberTexts, {}),
    combine = Table.AddColumn(cartesian, "combo", each [letter] & Text.From([number]))[[combo]]
in
    combine
Regards,
 
Upvote 0
Thanks anvg for your reply, I am still seeing an error though when I try and follow the steps suggested, Sandy, are you able to send over the sample file so that hopefully it shows me where I am going wrong?

Many thanks
 
Upvote 0
Hi both..... the eagle has finally landed! :) all working now, thanks once again, really appreciated
 
Upvote 0

Forum statistics

Threads
1,223,809
Messages
6,174,761
Members
452,582
Latest member
ruby9c

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