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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Chris2016
Resolver I
Resolver I

Calculated table using DISTINCT UNION to get several columns from other tables

Hi,

I have a calculated table that is aggregating the (distinct) Name column from other tables. How do I tweak the formula to get other columns from those tables as well (such as Address, Location of the "Name", etc)?

Thanks a lot for any help!

New table= 
DISTINCT (
    UNION (
        VALUES ( 'Table1'[Name] ),
        VALUES ( 'Table2'[Name] ),
        VALUES ( 'Table3'[Name] ),
        VALUES ( 'Table4'[Name] ),
        VALUES ( 'Table5'[Name] ),
        VALUES ( 'Table6'[Name] ),
        VALUES ( 'Table7'[Name] )
    )
)
1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @Chris2016

If Address and Location are columns which are present in all the tables (Table1 ... Table7), you could transform your [DAX] query into something like this:

New table= 
DISTINCT (
    UNION (
        SELECTCOLUMNS ( Table1, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table2, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table3, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table4, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table5, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table6, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table7, "Name, "[Name], "Address", [Address], "Location", [Location] )
    )
)

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

2 REPLIES 2
barritown
Super User
Super User

Hi @Chris2016

If Address and Location are columns which are present in all the tables (Table1 ... Table7), you could transform your [DAX] query into something like this:

New table= 
DISTINCT (
    UNION (
        SELECTCOLUMNS ( Table1, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table2, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table3, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table4, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table5, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table6, "Name, "[Name], "Address", [Address], "Location", [Location] ),
        SELECTCOLUMNS ( Table7, "Name, "[Name], "Address", [Address], "Location", [Location] )
    )
)

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Yes, the other columns are in the same tables. Thanks a lot for the help, that works!

Best regards

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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