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
dennis1994
Frequent Visitor

Combine two tables

Hello,

I would like to combine table 1 and table 2 from my photo, so that i end up like table 3. i dont quit get it. Can someone help me please?

1.png

 

Regards

Dennis

1 ACCEPTED SOLUTION

hi, @dennis1994 @acanepa

 

1. Import the data from TABLE1
2. Import the data from TABLE2
3. Edit the query in TABLE2 and remove the duplicates
4. Combine tables TABLE1 and TABLE2
5. Group the values (as pictured)

 

 

 

 

Clipboard01.gifClipboard02.gifClipboard03.gif

Clipboard03b.gifClipboard04.gif

Clipboard05.gif


Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
 
Best Regards,
Rfranca

View solution in original post

5 REPLIES 5
acanepa
Resolver I
Resolver I

Hello @dennis1994,

 

You could use Crossjoin and filter to solve you issue.

 

I have created a sample workbook for replicating your data.

 

Table 3 is the example of what you want to achieve.

 

 

Table 1

 

table 1.png

 

Table 2

 

table 2.png

 

Table 3

table 3.png

 

 Code:

 

Table 3 = filter(
CROSSJOIN(Table1,Table2),[id]=[id2] && [Date] =[Date2])

 

I get the information from the following link:

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

 

Sample Workbook

https://ufile.io/rt1ae

 

Regards,

Hello acanepa,

 Thanks for the fast reply. Where exactly do i need to input the code? When i try to create a new table i get following error:

2.PNG

 

Ok i found my mistake.

The outcome is not completely how i would like to have it. What i get is a table with 7 rows:

image.png

What i want is a table with just 4 rows and the added column. As for several dates there are multiple rows in both tables, i get more rows then i want, what later falsifies my measures.

 

Another way i could think of is to "sum" table 1 something like:

If there are multiple values of column x for one date (e.g.: 09.01 has value 1 and value 0 -->two differnt rows) sum them so that there is just one row for that date

Something like this:

2.PNG

Hi @dennis1994

 

You need to change the column name "dri_exact_date" in one of the tables, the formula does not allow two columns with the same name.

 

You could use SELECTCOLUMNS for filtering columns.

 

Regards,

hi, @dennis1994 @acanepa

 

1. Import the data from TABLE1
2. Import the data from TABLE2
3. Edit the query in TABLE2 and remove the duplicates
4. Combine tables TABLE1 and TABLE2
5. Group the values (as pictured)

 

 

 

 

Clipboard01.gifClipboard02.gifClipboard03.gif

Clipboard03b.gifClipboard04.gif

Clipboard05.gif


Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
 
Best Regards,
Rfranca

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.