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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AOD
Helper III
Helper III

Loop through existing data source table while extracting data from other new source

Hi All,
I have a requirement to Loop through existing data source table while extracting data from another new source.
I have Table (Eg Table1) with Job ID field already loaded into PowerBI, Would like to load data from web datasource using API. This API has mandatory Job Id_ref field in it.
My requirement is to load data from API datasource for all records of JOB ID from Table1.
Appreciate your help.
Thanks in advance.
AOD

3 REPLIES 3
AOD
Helper III
Helper III

Hi , Thanks for reply . 

I am trying to create function using it in other table by ADD column as below , but getting Token Literal error, unable to proceed .

let
UserName = () => (WORKER_REF as text) =>
let
Source = Json.Document(Web.Contents("https://**************/api/Roles/GetUserDetailByAzureAD?user_ref=('" &WORKER_REF& "')"),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded Data" = Table.ExpandRecordColumn(#"Converted to Table", "Data", {"OdataContext", "businessPhones", "displayName", "givenName", "jobTitle", "mail", "mobilePhone", "officeLocation", "preferredLanguage", "surname", "userPrincipalName", "id"}, {"Data.OdataContext", "Data.businessPhones", "Data.displayName", "Data.givenName", "Data.jobTitle", "Data.mail", "Data.mobilePhone", "Data.officeLocation", "Data.preferredLanguage", "Data.surname", "Data.userPrincipalName", "Data.id"}),
#"Expanded Data.businessPhones" = Table.ExpandListColumn(#"Expanded Data", "Data.businessPhones"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Data.businessPhones",{{"Code", Int64.Type}, {"Message", type text}, {"Data.OdataContext", type any}, {"Data.businessPhones", type any}, {"Data.displayName", type text}, {"Data.givenName", type text}, {"Data.jobTitle", type any}, {"Data.mail", type any}, {"Data.mobilePhone", type any}, {"Data.officeLocation", type any}, {"Data.preferredLanguage", type any}, {"Data.surname", type text}, {"Data.userPrincipalName", type text}, {"Data.id", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Code", "Message", "Data.OdataContext", "Data.businessPhones", "Data.givenName", "Data.jobTitle", "Data.mail", "Data.mobilePhone", "Data.officeLocation", "Data.preferredLanguage", "Data.surname", "Data.userPrincipalName", "Data.id"}),
in
#"Removed Columns",
in
UserName

Capture.JPG

That's not what I meant.  Have your standard list of worker IDs as a table.  Add a column that calls the API for each worker.  No need to specify this as a separate function (in fact it will be counter productive as you will run into the formula firewall.  Keep all your calls in the same partition.

lbendlin
Super User
Super User

That is straightforward Table.AddColumn functionality.  What have you tried and where are you stuck?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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