Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi guys,
I have the following problem. I have two tables (Table1, Table 2) with this structure:
Table 1 have these fields: (Material, Desripción, Sales and Stock)
Table 2 have these fields: (Material, Descripción, Sales, Store and TT)
As you can see both aren´t identical table. So i need to join the two in a new table, but i have to include both materials in both tables and sum the Sales when the material is the same. For those columns when doesn´t exists in the other table, simply put null.
I´m trying to do it with Merge, but put the Material in different columns.
Could u help me please?
Thanks!!!
Solved! Go to Solution.
HI, @JuanVR10
You could try these two ways as below:
1. use DAX to create a calculate table by this formula:
Dax table = VAR _UNIONTABLE=UNION(SELECTCOLUMNS(Table1,"Material",[Material],"Descripcion",[Descripcion],"Sales",[Sales],"Store",BLANK(),"Stock",[Stock],"TT",BLANK()), SELECTCOLUMNS(Table2,"Material",[Material],"Descripcion",[Descripcion],"Sales",[Sales],"Store",[Store],"Stock",BLANK(),"TT",[TT])) RETURN GROUPBY(_UNIONTABLE,[Material],[Descripcion],"Sales",SUMX(CURRENTGROUP(),[Sales]),"Store",MAXX(CURRENTGROUP(),[Store]),"Stock",SUMX(CURRENTGROUP(),[Stock]),"TT",SUMX(CURRENTGROUP(),[TT]))
Result:
2. In Edit Queries, Use Append function and group by function to create a new table
Result:
here is pbix file, please try it.
Best Regards,
Lin
Seems you are doing a merge query when you ought to be doing an Append
HI, @JuanVR10
You could try these two ways as below:
1. use DAX to create a calculate table by this formula:
Dax table = VAR _UNIONTABLE=UNION(SELECTCOLUMNS(Table1,"Material",[Material],"Descripcion",[Descripcion],"Sales",[Sales],"Store",BLANK(),"Stock",[Stock],"TT",BLANK()), SELECTCOLUMNS(Table2,"Material",[Material],"Descripcion",[Descripcion],"Sales",[Sales],"Store",[Store],"Stock",BLANK(),"TT",[TT])) RETURN GROUPBY(_UNIONTABLE,[Material],[Descripcion],"Sales",SUMX(CURRENTGROUP(),[Sales]),"Store",MAXX(CURRENTGROUP(),[Store]),"Stock",SUMX(CURRENTGROUP(),[Stock]),"TT",SUMX(CURRENTGROUP(),[TT]))
Result:
2. In Edit Queries, Use Append function and group by function to create a new table
Result:
here is pbix file, please try it.
Best Regards,
Lin
Thanks a lot my friend
It works perfectly
Best Regards
Juan
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 44 | |
| 40 | |
| 29 | |
| 19 |
| User | Count |
|---|---|
| 200 | |
| 126 | |
| 103 | |
| 70 | |
| 53 |