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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
VinceA
New Member

API Timed Call Limit Reached in Power Query

I am working on a portfolio project where I am trying to analyze weekly stock data over the past two years. I have connected Power BI to a free AlphaVenture API but am running into an issue when trying to run my API function as I am hitting the call limit (5 calls per minute).

 

Does anyone know how to get around this issue? Would really appreciate it!

Copy of my M code: https://ufile.io/gtqr80jl

 

ss api error.JPG

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please see this article to see how to add a delay after each call.

Chris Webb's BI Blog: Using Function.InvokeAfter() In Power Query Chris Webb's BI Blog (crossjoin.co...

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hello,

 

Thank you for the quick response and the reference. I've tried to use function.invokeafter for the past couple of hours in different orders in the query but I can't seem to get it to work. I do not have much experience with M - all of my work in PowerQuery has been using the UI.

 

Below is a copy of my most recent attempt. I seem to be adding a delay since invoking the custom function is taking minutes as opposed to seconds, but I am still getting an error, which I'm assuming means I am delaying something other than the actual call to the API.

let
    Output = Function.InvokeAfter(()=> Source, #duration(0,0,0,13)),
    Source = (symbol) =>
    
    let
        Source = Json.Document(Web.Contents(
            "https://www.alphavantage.co/",
            [
            RelativePath="query",
            Query=
                [
                function = "TIME_SERIES_WEEKLY",
                symbol=symbol,
                apikey="placeholder"
                ]
            ]
    )),

        #"Weekly Time Series" = Source[Weekly Time Series],
        #"Converted to Table" = Record.ToTable(#"Weekly Time Series"),
        #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"1. open", "2. high", "3. low", "4. close", "5. volume"}, {"1. open", "2. high", "3. low", "4. close", "5. volume"})
    in
        #"Expanded Value"
in
    Output

 

Depending on the order I add function.invokeafter in, I get errors about converting a function to a record. Would you be able to provide specific input on where/how to add the function? It would be very much appreciated since I am unfortunately very stuck.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.