Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowGet certified as a Fabric Data Engineer: Check your eligibility for a 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700. Get started
Hi All,
I have this interview question today which i have doubt in answering , Can some one please help with the correct answer.
Question: Can we append two columns with same datatype from 2 different tables which has space in Column Name of one table For example: TableA with Column Name as Merchant Country (space between) and TableB with Column Name as MerchantCountry (no space).
Thanks,
@naveenskyline This question is intended to guage your Power Query skill level. I ask similar questions to candidates. If you want to really understand the answer it would be best for you to create some dummy data in Power Query which matches the scenario and then try to append the two columns, see what happens and what you need to do to make it work. It will not work in the state described by the scenario without transformations. I don't think the interviewer is looking for an answer that involves a relationship between the tables. Try to append the data from these two tables below. What do you have to do to make it work? I could tell you the answer but I think it would be best if you learn the answer by doing it.
Table1
// Table1
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWcgKTzkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Merchant Country" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Merchant Country", type text}})
in
#"Changed Type"
Table2
// Table2
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclGK1YlWcgWTbkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MerchantCountry = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"MerchantCountry", type text}})
in
#"Changed Type"
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
@jennratten - Thank you making me learn. I tried creating an example and replicated the interview question in the power query . what i got was - It created 2 columns seperately instead of appending and creating/ considering as a single column it created 2 columns (Merchant Country and MerchantCountry ) where MerchantCountry has NULL's .
Great - Were you able to transform the data so that the two tables appended as expected instead of separately?
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
I did renamed the column by removing the space and then appended then it worked .
please let me know if you have any other transformation other than this . Thanks
Hi @naveenskyline ,
To combine columns from two tables in Power Query,
if the column names are different,
you need to make the names the same first.
You did it right by renaming the column to remove the space.
This is the simplest way to make sure the columns from both tables come together as one when you append them.
Chiranjeevi Kudupudi
@sunny18pc - Sorry I cannot understand your solution. Can you please ellaborate a bit more? I want to know if Powerquery Will append the columns or not?
Thanks,
Hi,
Yes that can be done easily by calling the column name from Table A and Table ,once we establish a realtion between both table.
Hope I was able to clarify your query.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
18 | |
10 | |
9 | |
9 | |
8 |
User | Count |
---|---|
16 | |
15 | |
13 | |
12 | |
11 |