Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm new to Power Query. Is it possible to combine 4 worksheets into one based on a single key such as IP Address?
Solved! Go to Solution.
Hi @Rnaval ,
You can certainly automate this process to run daily. Since your merges are already functioning correctly, you are well positioned for automation. Power Query is designed to repeat all your steps, such as removing duplicates and merging, each time the query refreshes. Therefore, automation mainly involves setting up a consistent refresh schedule rather than changing your existing setup.
If you are using Microsoft Excel, you can configure the query to refresh automatically when the file is opened, ensuring your master file always reflects the latest data. This solution works well if someone opens the file daily. If you require the process to run independently, you may need to use an external tool, such as a scheduled task or a cloud-based flow, to open and refresh the file at regular intervals.
For a fully automated, hands-off process, Microsoft Power BI is often preferable. Once your query is built, you can publish it and schedule daily refreshes, providing a reliable solution for ongoing operations.
Regardless of the method chosen, ensure that your source files remain consistent in terms of file names, locations, column structures, and the IP Address field format. Your duplicate handling logic in Power Query will continue to operate automatically with each refresh. At this stage, you do not need to modify your query logic simply determine the most suitable way to trigger the daily refresh based on your automation needs.
Thank you.
In Power Query:
Select your main query
Choose Home → Merge Queries
Select the second worksheet
Click IP Address in both tables
Choose the join type
Usually you want:
Left Outer → keep all rows from the first sheet, bring matching data from the second
Repeat for the 3rd and 4th worksheets.
After each merge, Power Query will create a nested table column.
Click the expand icon and select the columns you want to bring in.
Once all merges are done, click Close & Apply (Power BI) or Close & Load (Excel).
@Rnaval sure you can!
Yes, absolutely — it's not only possible, it's one of the most common and powerful things Power Query does very well.
Since you're new to Power Query, I'll explain the two main ways to "combine" 4 worksheets, and which one you probably want when you mention "based on a single key such as IP Address":
| Stack rows on top of each other (same columns, more records) | Append | Puts Sheet2 under Sheet1, Sheet3 under that, etc. | You just want a big long list of all records |
| Join side-by-side (add columns from other sheets) using IP Address as the matching key | Merge | Like VLOOKUP / XLOOKUP but for whole tables — brings matching data from other sheets into the main one | You want to enrich one main sheet with info from the others using IP Address |
Most people who say "combine based on a key like IP Address" actually mean Merge (joining horizontally by matching IP).
Use Merge if the 4 sheets have different columns but share IP Address as the common identifier.
Example:
→ You want one big table with all columns, matched by IP Address.
Open Excel → go to the Data tab → Get Data → From Other Sources → Blank Query (or From File → From Workbook if you want to start from one sheet)
In Power Query Editor, create 4 separate queries — one for each sheet:
Tip: Make sure IP Address column is the same data type in all sheets (usually Text). Right-click the column → Change Type → Text.
Decide your main / left table (usually the most complete one — let's say Sheet1_IPs).
With Sheet1_IPs selected, go to Home tab → Merge Queries → Merge Queries as New (safer for beginners)
In the merge dialog:
A new column appears (usually called Sheet2_Usage) → click the expand icon (two arrows)
Repeat steps 4–6 for the other two sheets:
When finished → Home → Close & Load → choose To new worksheet
You now have one combined table where every IP from the main sheet has extra columns pulled from the other sheets (null if no match).
Only do this if all 4 sheets have almost identical columns (same names, same order is ideal).
But since you mentioned "based on a single key such as IP Address", Merge is almost certainly what you're after.
I hope this helps. if so please mark it as a solution. kudos are welcome!
Actually, I do see the third Merge query and I was able to remove duplicates from the 3 files that I merged prior to the close and load in order to end up with the correct total count. Question now is that is there a way to automate this power query so it happens daily?
Hi @Rnaval ,
You can certainly automate this process to run daily. Since your merges are already functioning correctly, you are well positioned for automation. Power Query is designed to repeat all your steps, such as removing duplicates and merging, each time the query refreshes. Therefore, automation mainly involves setting up a consistent refresh schedule rather than changing your existing setup.
If you are using Microsoft Excel, you can configure the query to refresh automatically when the file is opened, ensuring your master file always reflects the latest data. This solution works well if someone opens the file daily. If you require the process to run independently, you may need to use an external tool, such as a scheduled task or a cloud-based flow, to open and refresh the file at regular intervals.
For a fully automated, hands-off process, Microsoft Power BI is often preferable. Once your query is built, you can publish it and schedule daily refreshes, providing a reliable solution for ongoing operations.
Regardless of the method chosen, ensure that your source files remain consistent in terms of file names, locations, column structures, and the IP Address field format. Your duplicate handling logic in Power Query will continue to operate automatically with each refresh. At this stage, you do not need to modify your query logic simply determine the most suitable way to trigger the daily refresh based on your automation needs.
Thank you.
Hi @Rnaval ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
This is resolved thanks to the help from the members on this thread.
Hi @Rnaval ,
Thank you @cengizhanarslan for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you.
Hi @Rnaval ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
I have 4 files - Master, Operating System, Scan Date and Logon ID. The master is my main file then I want to bring in a single column from each of the other files. I should end up with three columns added to the end of my Master file. I followed the steps above. However, I ended up with only a single additional column from the last sheet that I merged. The first two sheets' columns got overwritten I think. Somehow there is a step after merging the first sheet that I need in order to end up with 3 new columns.
Thank you so much, you have explained this so well! And yes it's the Merge option that I'm going to use. I'll try it this weekend and let you know how it goes.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 |