cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ermak
Frequent Visitor

Loop the query and pause between requests

Hello. Ask for help.

I'm taking data from the API through a function. If the data is not ready, the API gives the message "Your report is not ready yet, try to update it later". Then I need to wait 10-20 seconds and update the request. Sometimes I need to update 2-3-5 times, depending on the amount of data.

Is it possible to loop the query until it returns data instead of the phrase "Your report is not ready yet..."? And can I set a pause between requests?

 

let
    Source = PQYD(Date_and_API{0}[APID], null, "Date,Impressions,Clicks,Ctr,Cost,AvgCpc,AvgClickPosition,CampaignName,AdGroupName,Criteria,AdNetworkType,LocationOfPresenceName", "CRITERIA_PERFORMANCE_REPORT", Date_and_API{0}[30 days ago], Date_and_API{0}[Yesterday])
in
    #"Source"

image.png

 

After a few updates

image.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Loop the query and pause between requests

@ermak ,

 

Power query supports loop/iteration but doesn't support function like pause/sleep, about the workaround, I would suggest you to refer to similar thread:

https://community.powerbi.com/t5/Desktop/Query-to-Scrap-URLs-with-a-pause-every-xx-URLs/td-p/352809

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Loop the query and pause between requests

@ermak ,

 

Power query supports loop/iteration but doesn't support function like pause/sleep, about the workaround, I would suggest you to refer to similar thread:

https://community.powerbi.com/t5/Desktop/Query-to-Scrap-URLs-with-a-pause-every-xx-URLs/td-p/352809

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors