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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shelley
Continued Contributor
Continued Contributor

Create a table with distinct rows from three other tables

This is probably easy for somebody out there as I think I am just missing something small. I am trying to create a "Link" table from multiple columns in three other tables. However, I am getting some duplicate rows - all fields are exactly the same. I want all duplicate rows removed. So I can use this as a Link or Bridge table to connect three fact tables and another geographic table. I could cut this down to only two columns, one for each key, but I need a minimum of two columns with distinct rows. 

This is what I'm trying:

Link Table =
DISTINCT(UNION(
 SELECTCOLUMNS(
'AOP and Forecast', "%GeoSBUProductLineKey", 'AOP and Forecast'[%GeoSBUProductLineKey], "%GeoKey", 'AOP and Forecast'[%GeoKey], "Region1", 'AOP and Forecast'[Region - 1st Level], "Region2", 'AOP and Forecast'[2nd Level], "Region3", 'AOP and Forecast'[3rd Level], "Region4", 'AOP and Forecast'[4th Level], "SBU", 'AOP and Forecast'[SBU ], "Product Line", 'AOP and Forecast'[Product Line ]
),
 SELECTCOLUMNS(
'CopaEndCustomer2', "%GeoSBUProductLineKey", CopaEndCustomer2[%GeoSBUProductLineKey], "%GeoKey", 'CopaEndCustomer2'[%GeoKey],"Region1", 'CopaEndCustomer2'[World Region WILL CHANGE], "Region2", 'CopaEndCustomer2'[Geo Level2 WILL CHANGE], "Region3", 'CopaEndCustomer2'[Geo Level3 WILL CHANGE], "Region4", 'CopaEndCustomer2'[Geo Level4 WILL CHANGE], "SBU", 'CopaEndCustomer2'[SBU], "Product Line", 'CopaEndCustomer2'[ProfitCenterGroup]
),
    SELECTCOLUMNS(
'OrdersView', "%GeoSBUProductLineKey", OrdersView[%GeoSBUProductLineKey], "%GeoKey", 'OrdersView'[%GeoKey],"Region1", 'OrdersView'[World Region WILL CHANGE], "Region2", 'OrdersView'[Geo Level2 WILL CHANGE], "Region3", 'OrdersView'[Geo Level3 WILL CHANGE], "Region4", 'OrdersView'[Geo Level4 WILL CHANGE], "SBU", 'OrdersView'[SBU], "Product Line", 'OrdersView'[ProfitCenterGroup]
)
))

@ImkeF Do you have any ideas?

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Shelley,


Can you please share some sample data to help us clarify your scenario?

BTW, I don't think distinct function will suitable for your requirement, current it will compare with all columns and remove duplicate records.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.