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
siva_powerbi
Helper IV
Helper IV

Merge table using DAX and Create a calculated table

I have 2 tables, I have merged in Power Query and created a Merged table (Columns from both tables), but I need to do the same using DAX without using power Query.

 

loaded tables into Power BI and linked the sheets, but unable to create the calcualted tables as the combination of columns from both the tables, I am able to create the calculated table from either of the tables but not from both the tables combined.

 

Table1                                                           

Test1Test2
Jobs1
Jobs11


   Table 2

 

Test3Test4
11
11

In power query I have merged tables(Inner Join) and created a new result set

 

Test1Test2Test3Test4

 

I pulled resultset to DAX and created calculted table.

 

But my requirement is link tables in DAX and create a calcualted table. Here I am able to create for one table and not for 2 tables.

 

Not sure how to merge 2 tables in dax and create a calculated table.

 

Thanks for help

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @siva_powerbi ,

 

The .pbix file you share cant be opened;

I use your sample data for instance:

First create a relationship between the 2 tables,

Screenshot 2020-09-21 171820.png

Then create a new table as below:

Table = ADDCOLUMNS('Table1',"Test 3",CALCULATE(MAX('Table2'[Test3]),USERELATIONSHIP(Table1[Test2],Table2[Test3])),"Test 4",CALCULATE(MAX('Table2'[Test4]),USERELATIONSHIP(Table1[Test2],Table2[Test3])))

And you will see:

Screenshot 2020-09-21 172209.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi  @siva_powerbi ,

 

The .pbix file you share cant be opened;

I use your sample data for instance:

First create a relationship between the 2 tables,

Screenshot 2020-09-21 171820.png

Then create a new table as below:

Table = ADDCOLUMNS('Table1',"Test 3",CALCULATE(MAX('Table2'[Test3]),USERELATIONSHIP(Table1[Test2],Table2[Test3])),"Test 4",CALCULATE(MAX('Table2'[Test4]),USERELATIONSHIP(Table1[Test2],Table2[Test3])))

And you will see:

Screenshot 2020-09-21 172209.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

@v-Kellu-msft Thanks for the Answer. Will try the solution and accept it as answer, tomorrow. Thanks Siva
amitchandak
Super User
Super User

@siva_powerbi , The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in a table format? Or a sample pbix after removing sensitive data.

 

Dax, how to join, merge, etc you can refer: https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/
Appreciate your Kudos.


@amitchandak Thanks for reply.

Attached files and data source file.

In Power Query file I was able to merge and create a calcualted table in DAX

In DAX though I have linked I am unable to get the calculated table with columns from both the tables,

I have added a simple example to sum the columns but y original calculation is more complex and need to merge 2 tables in DAX.

Please access files from below link as unable to add pbix files in forum.

https://www.dropbox.com/s/ukfj20r4ro82fus/Forum.zip?dl=0

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.