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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wickert11
Frequent Visitor

How to Loop through Systems and Append?

Thank you in advance I'm new to power query so any guidance is greatly appreciated. 

 

I typically create a connection and query for each system but now as I have 100+ systems and will need to be able to update the query frequently I need some way of looping through the systems and appending the data. 

I have my list of systems stored in a separate table. 

let
Source = Odbc.DataSource("dbq=RTW001A.WORLD;dsn=RTW", [HierarchicalNavigation=true]),
RTW_Schema = Source{[Name="RTW",Kind="Schema"]}[Data],
JOB_CODE_Table = RTW_Schema{[Name="JOB_CODE",Kind="Table"]}[Data],
#"Removed Other Columns" = Table.SelectColumns(JOB_CODE_Table,{"JBCD_JOB_CODE", "DESCRIP"})
in
#"Removed Other Columns"

1 ACCEPTED SOLUTION
miguel
Community Admin
Community Admin

Hey!

 

You can parametrize some of the logic inside your query and then convert your query into a function and use it as reusable piece of logic.

Below is the official documentation on how to create a custom function in Power Query:

Using custom functions in Power Query - Power Query | Microsoft Docs

 

Hope this helps!

View solution in original post

2 REPLIES 2
miguel
Community Admin
Community Admin

Hey!

 

You can parametrize some of the logic inside your query and then convert your query into a function and use it as reusable piece of logic.

Below is the official documentation on how to create a custom function in Power Query:

Using custom functions in Power Query - Power Query | Microsoft Docs

 

Hope this helps!

wickert11
Frequent Visitor

Each System has an identical table structure. It's just different locations

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors