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
a4
Helper III
Helper III

How to combine two columns from two different table into a new table

Hi all

I have two different  tables (accounts and leads) which both have their columns. I want to create a new table by combining the _memberno of accounts table with _coldprospectrefernce of leads table into a single column and name of accounts table with fullname of leads table into another column.

 

The datatypes of columns are same .

Capture.PNG

 

 

Please find the screenshot above. Any help is appreciated.

 

Kind Regards

Amit Kumar

1 ACCEPTED SOLUTION

Hi @v-zhenbw-msft 

Thanks for the solution but I figured the solution by my own.

This is what I did: 

Combination =
UNION(SUMMARIZE(accounts,accounts[_memberno],accounts[name]),SUMMARIZE(leads,leads[_coldprospectreference],leads[fullname]))
 
Kind Regards
Amit Kumar

View solution in original post

7 REPLIES 7
FOliveira
Frequent Visitor

How can we do this in the Query Editor?
Any ideas?

v-zhenbw-msft
Community Support
Community Support

Hi @a4 ,

 

Does the following screenshot meet your requirement?

 

h1.jpg

 

If yes, you can refer the below steps.

 

1. Create a new table that contains name column and fullname column.

 

Table = 
    UNION(VALUES(accounts[name]),VALUES(leads[fullname]))

 

h2.jpg

 

2. Then create a new column to get the memberno and coldpropectrefrence.

 

Column = 
var _account_value = CALCULATE(SUM(accounts[memberno]),FILTER(accounts,'Table'[name]=accounts[name]))
var _leads_value = CALCULATE(SUM(leads[coldprospectrefrence]),FILTER(leads,'Table'[name]=leads[fullname]))
return
IF(
    ISBLANK(_account_value),_leads_value,_account_value)

 

h3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

Hi @v-zhenbw-msft 

Thanks for the solution but I figured the solution by my own.

This is what I did: 

Combination =
UNION(SUMMARIZE(accounts,accounts[_memberno],accounts[name]),SUMMARIZE(leads,leads[_coldprospectreference],leads[fullname]))
 
Kind Regards
Amit Kumar

Hi @a4 ,

 

Glad to hear that you find the solution.

Please kindly mark your reply as a solution to help others find it more quickly and end this thread.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

negi007
Community Champion
Community Champion

@a4 

 

Under the table tools select new table and paste the below dax code. You may need to change the code according to your table structure

 

negi007_1-1605109001014.png

 

 

You can combine values from multiple columns and create one columns with unique values. 

Account_Leads= FILTER (
DISTINCT ( UNION ( VALUES ( Accounts[_memberno] ), VALUES ( leads[_coldprospectrefernce ])),
[new_tab] <> BLANK ()
)



Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Hi @negi007 

This is correct when I want to create a single column by combining values from other coulmns but over here i want  to create two columns.

 

_memberno + _coldprospectrefernce= 1st column.

name + fullname= 2nd column.

 

Please go through my first post for the problem statement.

 

Kind Regards

Amit Kumar

Hi negi0007,
This is not what I am looking for I want to combine  _memberno of accounts table with _coldprospectrefernce of leads table into a single column and name of accounts table with fullname of leads table into another column i.e 

I want two new columns to be created in a new table.

 

Kind Regards

Amit Kumar

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.