cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AbdulAzad
Frequent Visitor

Union not removing the duplicate data

Hi,

 

Looks like UNION DAX has a bug, its not removing the duplicate data, I tried to do union of two table by using the option to create a new table based on UNION DAX.

 

Union generally deletes duplicate data between two tables and union all keeps even the duplicate data. Here in Power BI desktop, I don't see the UNION is removing the duplicate data.

 

Can you guys please confirm, if it is a bug? If it is a bug then when can we expect the resolution?

 

Thanks & Regards,

Abdul

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

Hi @AbdulAzad ,


Accoridng to the official document , UNION() returns a table that contains all the rows from each of the two table expressions.

v-yalanwu-msft_0-1619404461156.png

IF you want to union and remove the duplicate data, you can use “distinct() ”to achieve it. The following is an example::
26.jpg
The final output is shown below:  UNION() vs DISTINCT(UNION())
newtable1 = UNION('Table','Table (2)')      vs      newtable2 = DISTINCT(UNION('Table','Table (2)'))

v-yalanwu-msft_1-1619404533473.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi @AbdulAzad ,


Accoridng to the official document , UNION() returns a table that contains all the rows from each of the two table expressions.

v-yalanwu-msft_0-1619404461156.png

IF you want to union and remove the duplicate data, you can use “distinct() ”to achieve it. The following is an example::
26.jpg
The final output is shown below:  UNION() vs DISTINCT(UNION())
newtable1 = UNION('Table','Table (2)')      vs      newtable2 = DISTINCT(UNION('Table','Table (2)'))

v-yalanwu-msft_1-1619404533473.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

It's not a bug.

"A table that contains all the rows from each of the two table expressions"

"Duplicate rows are retained"

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May 23 2022 episode 5 with aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt will talk about the importance of Data Modeling.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!