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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Union two tables and no duplicate the rows when date updated

Hi All,

 

I am new to PowerBi, I need your help please.

I have two tables (TABLE1, TABLE2) that i want to union:

TABLE 1       
ClientPartNoTitreTYPEStart Date projectedEnd Date projectedReal End DateProjet Name
ClientXXAAAATool ProveNPI09/03/202122/03/202121 mars 21FA1
ClientXXAAAAInspectionNPI09/05/202122/05/2021 FA1
ClientYYBBBBMethodesREV09/04/202122/04/2021 FA1

 

TABLE 2       
ClientPartNoTitreTYPEStart Date projectedEnd Date projectedReal End DateProjet Name
ClientXXAAAAInspectionNPI09/05/202122/05/202123 mai 21FA1
ClientYYBBBBMethodesREV09/04/202122/04/2021 FA1
ClientXXCCCCInspectionNPI10/04/202112/04/2021 FA2

 

The result I want after union (TABLE1; TABLE2) is like below:

ClientPartNoTitreTYPEStart Date projectedEnd Date projectedReal End DateProjet Name
ClientXXAAAATool ProveNPI09/03/202122/03/202121 mars 21FA1
ClientXXAAAAInspectionNPI09/05/202122/05/202123 mai 21FA1
ClientYYBBBBMethodesREV09/04/202122/04/2021 FA1
ClientXXCCCCInspectionNPI10/04/202112/04/2021 FA2

 

But with DAX, i obtain the table below which keeps the row of TABLE1 and the row with date updated in column "Real End Date" of TABLE2 instead of keeping just row of TABLE2.

ClientPartNoTitreTYPEStart Date projectedEnd Date projectedReal End DateProjet Name
ClientXXAAAATool ProveNPI09/03/202122/03/202121 mars 21FA1
ClientXXAAAAInspectionNPI09/05/202122/05/2021 FA1
ClientXXAAAAInspectionNPI09/05/202122/05/202123 mai 21FA1
ClientYYBBBBMethodesREV09/04/202122/04/2021 FA1
ClientXXCCCCInspectionNPI10/04/202112/04/2021 FA2

 

 

 

Table =
Var UnionTable=UNION(SELECTCOLUMNS('TABLE1';"Client";'TABLE1'[Client];"PartNo";"TABLE1"[PartNo];"Titre";'TABLE1'[Titre];"TYPE";'TABLE1'[TYPE];"Start Date projected";'TABLE1'[StartDate];"End Date projected";'TABLE1'[EndDate];"Real End Date";'TABLE1'[RealEndDate];"Projet Name";'TABLE1'[ProjName]);SELECTCOLUMNS('TABLE2';"Client";'TABLE2'[Client];"PartNo";"TABLE2"[PartNo];"Titre";'TABLE2'[Titre];"TYPE";'TABLE2'[TYPE];"Start Date projected";'TABLE2'[StartDate];"End Date projected";'TABLE2'[EndDate];"Real End Date";'TABLE2'[RealEndDate];"Projet Name";'TABLE2'[ProjName]))
Return
Groupby(UnionTable;[Client];[PartNo];[Titre];[TYPE];[Start Date projected];[End Date projected];[Real End Date];[Projet Name])

 

Anyone knows how to fix this problem ?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable
5 REPLIES 5
Anonymous
Not applicable
Anonymous
Not applicable

Hi @Anonymous 

 

DAX is not a tool for data mashup; it's a language for data analysis. M is such a language. Please use Power Query to union two tables. Trying to sqeeze a square peg into a round hole is not the best idea.

Anonymous
Not applicable

Thank you Daxer !, i will try to union it in power query.

MattAllington
Community Champion
Community Champion

My guess is that your datamodel is not optimal. I can't think of many usecases where is is good practice to load 2 tables and then Union them. Have you considered appending the tables using power query before load?  

Union in DAX is the same as Unionall in SQL. If you want the Union equivalent you need to use 

DISTINCT(UNION(table1,table2))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

Hi MattAllington, non, i have just transform the tables in power query. Not append the tables. I will try it.  Thank you for your suggestion.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.