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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
nok
Advocate II
Advocate II

Create bridge table with distinct IDs and duplicate values for RLS

Hey!
I have five tables in my report (TBL1, TBL2, TBL3, TBL4, and MainTable) and the only thing that changes is the data in each table (since each table is from a different area). All tables follows a similar structure like this:

ID     AREA     SECTOR   VALUE
1HyhoSP-1235
2CoexTek22
3ComaliOPL187
4KioiSP-154
5AbegTek90


I have a main table, which contains all the data from all the other tables combined, called MainTable. I want to relate the MainTable to all the other four tables by ID, so that there is no many-to-many relationship between them. Therefore, I want to create a bridge table that contains only the distinct IDs of all the tables in my report, so that TBL1, TBL2, TBL3 and Main Table relate to this bridge table.

In addition to this distinct ID column, I want this bridge table to contain a second column that represents the join of all the Sectors from each of the tables. This column doesn't need to have only distinct values, as I will use it in the RLS.

The expected bridge table would look like this:

IDSECTOR
1SP-1
2Tek
3OPL1
4SP-1
5Tek

 

Sem título.png

 

How can I create this bridge table with these two columns?

1 ACCEPTED SOLUTION
MasonMA
Community Champion
Community Champion

Hello @nok 

 

To automate this in Power Query, you may also use below M codes in a blank query (please adjust the your table names for the Source)

let
    Source = {
        TBL1,
        TBL2, 
        MainTable
    }, // Rename your tables for the source

    Combined = Table.Combine(
        List.Transform(
            Source,
            each Table.SelectColumns(_, {"ID", "SECTOR"})
        )
    ),

    DistinctPairs = Table.Distinct(Combined)
in
    DistinctPairs

 You will get below Bridge table in Power Query 

MasonMA_0-1754983779914.png

and then build your relationship in Power BI. 

MasonMA_1-1754984011175.png

Hope this helps:) 

View solution in original post

9 REPLIES 9
v-venuppu
Community Support
Community Support

Hi @nok ,

I hope the information provided is helpful.I wanted to check whether you were able to resolve the issue with the provided solutions.Please let us know if you need any further assistance.

Thank you.

v-venuppu
Community Support
Community Support

Hi @nok ,

May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

Thank you.

v-venuppu
Community Support
Community Support

Hi @nok ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @Greg_Deckler @swathigouda @MasonMA @Jaraxus for the prompt response.

I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.

Thank you.

Greg_Deckler
Community Champion
Community Champion

@nok In DAX that would be: 

New Table = DISTINCT( SELECTCOLUMNS( 'Table', "ID", [ID], "SECTOR", [SECTOR] ) )


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...
swathigouda
Regular Visitor

Hi @nok 
You can append table1....tablex and delete the column accept ID and remove duplicates.
then you will have a  bridge table ready where you can use it to build relationships

swathigouda_2-1754988095839.png

 

 

 

 

MasonMA
Community Champion
Community Champion

Hello @nok 

 

To automate this in Power Query, you may also use below M codes in a blank query (please adjust the your table names for the Source)

let
    Source = {
        TBL1,
        TBL2, 
        MainTable
    }, // Rename your tables for the source

    Combined = Table.Combine(
        List.Transform(
            Source,
            each Table.SelectColumns(_, {"ID", "SECTOR"})
        )
    ),

    DistinctPairs = Table.Distinct(Combined)
in
    DistinctPairs

 You will get below Bridge table in Power Query 

MasonMA_0-1754983779914.png

and then build your relationship in Power BI. 

MasonMA_1-1754984011175.png

Hope this helps:) 

Jaraxus
New Member

@nok You can do it in Power Query. Append queries as a new (TBL1-TBLX), then select only needed columns and remove duplicates.

Greg_Deckler
Community Champion
Community Champion

@nok Can you provide a sample file or at least sample data for this?



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

@Greg_Deckler , Hi!
I edited the question, inserting sample data, a result of what the final bridge table should look like and also a model of what I want to do with the relationship between these tables.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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