Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bajimmy1983
Helper V
Helper V

Concatenate OR Join Columns values

Hi community!

 

Could you please help? 

 

I am trying to add a custom column called [IndexKey] in Power Query to deliver the same outcome I have in a normal Excel table. 

 

In a normal excel I have the following columns and values:

[PO number] (type as general) = 123456

[BillingDate] (type as short date) = 01/01/16

[CampaignName] (type as general) = Emirates is the best

 

When I use EXCEL CONCATENATE function I got "12345642370Emirates is the best" (this is exactly what I need as a kind of an index key)

 

Now jumping into Power Query, when I try this: [PO number] & [BillingDate] & [CampaignName] I got: "12345601/01/16Emirates is the best" (this is what I do NOT want).

 

I can imagine why this is happening (I think because of the special character &), but I want discover a way in which I could get the same outcome as Excel tables, but adding a custom column through user interface in Power Query.

 

Thanks again for your support.

Jaderson Almeida
Business Coordinator
2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Either convert your Date column to a Whole Number or create another column that just gets your Date column and switch it to a whole number, use that column instead of the original Date column in your concatenation. 

 

Or, do it all in one column like this:

 

Column = CONCATENATE(CONCATENATE([PO Number],[Date]*1.),[Campaign])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

BhaveshPatel
Community Champion
Community Champion

@bajimmy1983

 

If you have your data coming from excel sheets, You can convert the date format to number. Import this data to powerquery and change the data type of date column to Text. 

 

In order to join them together in one column, data types of all the columns must be same. The "& " operator is similar to Excel in powerquery custom column. 

 

If your data is not coming from excel, you can split the column in Query Editor and change the data type of all columns to text and then can be joined together.

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

5 REPLIES 5
BhaveshPatel
Community Champion
Community Champion

@bajimmy1983

 

If you have your data coming from excel sheets, You can convert the date format to number. Import this data to powerquery and change the data type of date column to Text. 

 

In order to join them together in one column, data types of all the columns must be same. The "& " operator is similar to Excel in powerquery custom column. 

 

If your data is not coming from excel, you can split the column in Query Editor and change the data type of all columns to text and then can be joined together.

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Thank you very much BhaveshPatel. Also a Good way. 🙂

Have a nice rest,
Jaderson Almeida
Business Coordinator
Greg_Deckler
Super User
Super User

Either convert your Date column to a Whole Number or create another column that just gets your Date column and switch it to a whole number, use that column instead of the original Date column in your concatenation. 

 

Or, do it all in one column like this:

 

Column = CONCATENATE(CONCATENATE([PO Number],[Date]*1.),[Campaign])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler,

Thanks. Good solution. Just a final question? Why did you use *1.? Is it was to convert Date into number format?

Thanks again.
Jaderson Almeida
Business Coordinator

Yes, it is one of those shorthand tricks you pick-up over time. Comes in handy.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.