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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

List.ParallelInvoke strange behaviour

Hi,
We are trying to use List.ParallelInvoke, in custom connector project, which calls Rest Api for fetching data.

When we pass parameters there is a hang.
shared ParallelInvoke.Contents = Value.ReplaceType(ParallelInvokeImpl, ParallelInvokeType); or  shared ParallelInvoke.Contents = (a as text) => NavTable() as table; we get hang of our connector.
In case of shared ParallelInvoke.Contents = () => NavTable() as table; it works fine.

ParallelInvokeType = type function (a as (type text meta [
Documentation.FieldCaption = "Frequency",
Documentation.AllowedValues = { "Monthly", "Daily", "Hourly" },
Documentation.FieldDescription = "Defines the sampling rate in which the data is retrieved from the source"
]))
as table meta [
// appears in the initial datasource parameter configuration dialog
Documentation.Name = "ABB Motion API parameters"
];

ParallelInvokeImpl = (a as text) =>
let
r = NavTable()
in
r;


Maybe you can help us, and tell, what can be the reason of this behaviour?  @artemus 

4 REPLIES 4
artemus
Microsoft Employee
Microsoft Employee

I don't think that function is offically supported. That being said, I think it needs to be invoked on a list stored in a deferred evaulation context like a record or a table.

Anonymous
Not applicable

We use it like this:


parallelRequest = () as table =>
let
l = {1 .. 30},
lf = List.Transform(l, each () => GetParallelData(_)),
p2 = List.ParallelInvoke({ () => GetParallelData(2), () => GetParallelData(3)}),
p = List.ParallelInvoke(lf, 10),
r = Table.Combine(p)
in
r;

GetParallelData = (postNumber as number) as table =>
let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts/" & Number.ToText(postNumber), [Headers=[Authorization="Bearer " & "asd"], ManualStatusHandling={400, 401, 403, 404, 429, 500, 503}])),
table = Record.ToTable(Source),
pivot = Table.Pivot(table, List.Distinct(table[Name]), "Name", "Value"),
r = pivot
in
r;

NavTable = () as table =>
let
source = #table({"Name", "Data", "ItemKind", "ItemName", "IsLeaf"}, {
{ "parallelRequest", parallelRequest(), "Table", "Table", true }
}),
navTable = Table.ToNavigationTable(source, {"Name"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
navTable;

 

1. Please write example, or correct our code...how to implement? @artemus 

2. Is there other methods in Power Query, for parallelizm? @artemus 

I think it *might* work (I haven't tried this myself) if you change a line from:

p2 = List.ParallelInvoke({ () => GetParallelData(2), () => GetParallelData(3)}),

to

p2 = List.ParallelInvoke([f = { () => GetParallelData(2), () => GetParallelData(3)}][f]),

 

2. Power query will generally execute items in parellel if they can be lazly loaded. Values in Records and Tables are loaded lazly.  Also note that running your connector in Visual studio works a bit differently than in Power Bi, in order to make debugging easier. If you aren't doing so already, test your connector in Power Bi (Power Bi will reload your connector every time it is modified).

Anonymous
Not applicable

I tried you code, it does not work, when I pass parameters in shared:
shared ParallelInvoke.Contents = Value.ReplaceType(ParallelInvokeImpl, ParallelInvokeType);

or  shared ParallelInvoke.Contents = (a as text) => NavTable() as table; 

 

It works for:

For shared ParallelInvoke.Contents = () => NavTable() as table  ,  when it without parameter.

@artemus What can be the reason?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors