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! Request now

Reply
Anonymous
Not applicable

How to get distinct values when two tables are joined using Union?

Hi,

I Have two tables, where table A has unique values and tables B(dynamically updated) will always contain a few records from table A.  Table A

1.png

 

Table B

2.png

 

When I do UNION, I get duplicate rows. 

 

5.png

 

I have also tried using 

Union = DISTINCT(UNION(VALUES('Table 2'[Date]),VALUES('Table 1'[Date])))  But I can only pull single column with Distinct values. 
4.png
 
I need all the columns Dates, Open, High, Low etc. without duplicate rows. 
 
Can anyone help me with this? 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous 

This is because open High, low values has some diff.

Use Summarize and take min and max of that

Try like

summarize(UNION(VALUES('Table 2'),VALUES('Table 1')),[Date],"Open",max([Open]),"Low",min([Low]),"High",max([High]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous 

This is because open High, low values has some diff.

Use Summarize and take min and max of that

Try like

summarize(UNION(VALUES('Table 2'),VALUES('Table 1')),[Date],"Open",max([Open]),"Low",min([Low]),"High",max([High]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

UNION in DAX is the same as UNIONALL in SQL. Wrap the whole thing inside DISTINCT()



* 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.

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.

Top Solution Authors