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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Marco_88
Helper I
Helper I

combine and iterate data

Hello everyone,

 

I’m Marco and I need your help. I’m quite new with PBI and I think this problem is easy for you.

I have 2 xls sheets called “Database” and “WP”. In each sheet I have a columns called JA_Code that we will use like key.

DATABASE.PNGWP.PNG

 

 

I would like to obtain a new table where, for each JA_Code of the WP Sheet, I obtain as many rows as those present in the Database sheet relating to the same JA_Code.

 

DESIRED RESULTS.PNG

 

To facilitate understanding I created a sheet called "Desired result" in the xls file where I grouped the rows with thick and thin lines based on the JA_Code of the WP sheet.

I Attach xls with all data.

 

I kindly ask you for a suggestion.

thank you very much for your help

 

Best
Marco

1 ACCEPTED SOLUTION
johnbasha33
Super User
Super User

@Marco_88 

Sure, Marco! You can achieve this by performing a merge operation in Power BI to combine the two tables based on the `JA_Code` column. Here are the steps to follow:

### Steps to Merge Tables in Power BI

1. **Load Data into Power BI:**
- Open Power BI Desktop.
- Go to `Home` -> `Get Data` -> `Excel`.
- Select your Excel file and import the `Database` and `WP` sheets.

2. **Open Power Query Editor:**
- Once the data is loaded, click on `Transform Data` to open the Power Query Editor.

3. **Merge Queries:**
- In the Power Query Editor, go to `Home` -> `Merge Queries` -> `Merge Queries as New`.
- In the `Merge` dialog, select the `Database` table as the first table and the `WP` table as the second table.
- Select the `JA_Code` column in both tables as the key column to match.
- Choose the `Inner Join` type to get only the matching rows.

4. **Expand Merged Columns:**
- After the merge, you will see a new column in the resulting table with a table icon.
- Click on the expand icon (two arrows pointing outwards) in the new column header.
- Select the columns you want to include from the `Database` table and click `OK`.

5. **Load the Data:**
- Once you have expanded the columns and have the desired structure, click `Close & Load` to load the data back into Power BI.

Following these steps, you should be able to create a new table in Power BI that matches the desired result you provided.

If you need further assistance or have additional questions, feel free to ask!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

View solution in original post

3 REPLIES 3
Marco_88
Helper I
Helper I

Thank you @johnbasha33 

I always use it but I don't know why this time didn't works.
I clear all my data and do it one time again with correct filters. and now it works. 

 

thank you.

 

Marco 

glad that it worked 🙂
johnbasha33
Super User
Super User

@Marco_88 

Sure, Marco! You can achieve this by performing a merge operation in Power BI to combine the two tables based on the `JA_Code` column. Here are the steps to follow:

### Steps to Merge Tables in Power BI

1. **Load Data into Power BI:**
- Open Power BI Desktop.
- Go to `Home` -> `Get Data` -> `Excel`.
- Select your Excel file and import the `Database` and `WP` sheets.

2. **Open Power Query Editor:**
- Once the data is loaded, click on `Transform Data` to open the Power Query Editor.

3. **Merge Queries:**
- In the Power Query Editor, go to `Home` -> `Merge Queries` -> `Merge Queries as New`.
- In the `Merge` dialog, select the `Database` table as the first table and the `WP` table as the second table.
- Select the `JA_Code` column in both tables as the key column to match.
- Choose the `Inner Join` type to get only the matching rows.

4. **Expand Merged Columns:**
- After the merge, you will see a new column in the resulting table with a table icon.
- Click on the expand icon (two arrows pointing outwards) in the new column header.
- Select the columns you want to include from the `Database` table and click `OK`.

5. **Load the Data:**
- Once you have expanded the columns and have the desired structure, click `Close & Load` to load the data back into Power BI.

Following these steps, you should be able to create a new table in Power BI that matches the desired result you provided.

If you need further assistance or have additional questions, feel free to ask!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.

Users online (11,489)