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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
deepali_garg
Frequent Visitor

How to get records from Table B related to an ID in Table A in power bI desktop

Hi All, 

I have 2 sheets in an excel file . Both sheets have a common column ID but have different related Line items.
My requirement is to get all the line items related to a particular ID from Sheet 2 dynamically and show it in a table visual for users to export the data.
For example:
Sheet 1 has 

deepali_garg_0-1666806734337.png

Sheet 2 

deepali_garg_1-1666806775657.png

I  have to fetch all the records from Sheet 2 based on ID in a table visual.



1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @deepali_garg ,

 

Yes. You can do it in the Power Query.

You also need to add an index column. Then 

vyinliwmsft_0-1666932823653.png

Merge query:

vyinliwmsft_2-1666933207635.png

vyinliwmsft_3-1666933222964.png

 

 

vyinliwmsft_1-1666933176082.png

 

vyinliwmsft_4-1666933251159.png

 

Is this what you expect?

Hope this helps you.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-yinliw-msft
Community Support
Community Support

Hi @deepali_garg ,

 

Yes. You can do it in the Power Query.

You also need to add an index column. Then 

vyinliwmsft_0-1666932823653.png

Merge query:

vyinliwmsft_2-1666933207635.png

vyinliwmsft_3-1666933222964.png

 

 

vyinliwmsft_1-1666933176082.png

 

vyinliwmsft_4-1666933251159.png

 

Is this what you expect?

Hope this helps you.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

deepali_garg
Frequent Visitor

Thank you for this approach . 
But is there any other way as i want to fetch multiple columns , so creating each calculated column would be a lengthy approach. 
Can I use merge functionality to achieve this?

v-yinliw-msft
Community Support
Community Support

Hi @deepali_garg ,

 

You need to add an index column for unique identification.

Table1:

vyinliwmsft_2-1666856891287.png

Table2:

vyinliwmsft_3-1666856912966.png

 

In the Power Query:

vyinliwmsft_0-1666856733701.png

Add the index column for Table1 and Table2.

Then create the new column in Table2:

New column:

Column = RELATED(Table1[UserName])
Column 2 = RELATED(Table1[Column1])
Column 3 = RELATED(Table1[Column2])

Table2:

vyinliwmsft_1-1666856854418.png

 

Is this what you expect?

Hope this helps you.

Here is the PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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