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
John_YZ
New Member

Create dimension table from multiple fact tables

Hi

I'm trying to create a dimension table for ID and Description from two different fact table.

TABLE1 and TABLE2 have several columns but I want to use only two, then remove duplicates for ID code.

When I use only CODE column it works fine, but when I try to bring the second column it duplicates one of ID rows.

I think it happens because the description/name is not exactly the same. For me it does not matter which one comes, since it brings one.

This is the code I'm using:

 

DISTINCT ( UNION( SUMMARIZE(TABLE1[CODE];TABLE1[DESCRIPTION]);SUMMARIZE(TABLE2[CODE];TABLE2[NAME])) )

 

I also tryied do make some kind of inner join but it yet duplicates:

 

IDTable = NATURALINNERJOIN ( 
                            DISTINCT(
                                UNION(
                                        DISTINCT(TABLE1[CODE]); 
                                        DISTINCT(TABLE2[CODE])
                                        )
                             ); 
                                UNION(
                                        SUMMARIZE(TABLE1[CODE];TABLE1[DESCRIPTION]);
                                        SUMMARIZE(TABLE2[CODE];TABLE2[NAME]) 

)
)

 

When I test it with one column only it does not duplicate the ID (same segment of code I try the inner join):

DISTINCT(UNION(DISTINCT(TABLE1[CODE]);DISTINCT(TABLE2[CODE]))

 

Anybody could help with this issue?

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

I think you are using DAX when you should probably be  using M (Power Query). Essentially, what I would suggest would be to create two new queries that pull from the exact same data sources but only includes the two rows you care about. Then, create an Append query that appends these together. Then, in this Append query, do a remove duplicates on your ID column. Disable data load and refresh on your two queries that are part of your Append query but leave data load and refresh enabled for your Append query. You should then have what you want, a table with distinct ID's.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

Show your datasets and the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

I think you are using DAX when you should probably be  using M (Power Query). Essentially, what I would suggest would be to create two new queries that pull from the exact same data sources but only includes the two rows you care about. Then, create an Append query that appends these together. Then, in this Append query, do a remove duplicates on your ID column. Disable data load and refresh on your two queries that are part of your Append query but leave data load and refresh enabled for your Append query. You should then have what you want, a table with distinct ID's.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors