March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello community!
I have a function which calls an API and then loops until all data are retrieved. Therefore, I am using List.Generate, however I am experiencing it to be extremely slow. The number of rows i approx 300.000 and it can take more than 10 minutes to retreive!
I have come across the List.Buffer or Table.Buffer which apperarently should enhance the performance, but I don't know where to include it in my query.
Can anyone help? 🙂
@ImkeF maybe?
Query:
Please see this approach as an alternative. Also, are you able to increase the number of records returned with each web call?
Power BI - Tales From The Front - REST APIs - YouTube
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Also the approach is using GET to my understanding right? Would prefer POST.
Hi
I have tried to watch the alternative in the video, but I am not quite sure how to implement that in my solution. Yes I am increasing the number of records. The limit is different for each endpoint in the API.
I thought that Buffer could decrease the performance time as it takes around 1,5 hours to refresh the report...
Hi @Laura_Dannisoe ,
a buffer is useful to stop re-evaluating tables or lists that will be referenced multiple times in iterators (like List.Generate, -.Accumulate, -.Transform or Table.AddColumn).
But in your iterator here (List.Generate), there is no direct list or table input (just records or scalars). Therefore you cannot use it here.
Does the function you're calling ("Resumekey_function") reference a table or a list? Then you might want to buffer that in there.
There are other things to watch out for when optimizing performance: Speed/Performance aspects – The BIccountant maybe you find a hint in there.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi Imke
Thank you for your answer.
The resumekey function looks like below - is there anything here I could buffer?
let
Kilde = (EndPoint as text, Resumekey as text, optional Changedate) =>
let
changedate = if Changedate = null then "" else Changedate,
url = "XXXXXXXXXXXXXX",
body = [contract=MB_Agreement,apikey=MB_Key,username=MB_User,password=MB_Password,commands={[command=EndPoint,changedate=changedate,resumekey=Resumekey]}],
data = Json.Document(Web.Contents(url,[Headers=[#"Content-Type"="application/json"], Content=Json.FromValue(body), IsRetry=true
]))[results]
in data
in
Kilde
It is just very frustrating that it takes 1,5 hours to refresh and 15 minutes to retrieve data from one table, so I thought there must be a way to handle this faster.
Hi @Laura_Dannisoe ,
no, cannot spot a table or a list to buffer in here.
Did you experience the performance degradation just today? Is it in dataflows in a Europe region?
Then this might just be a temporary problem: Slow Dataflow Refresh - Microsoft Power BI Community
Otherwise: How many other queries are there in your file/dataflow?
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi Imke
No I have experienced this ever since I did the API calls. Some dataflows only have 1 query while others have 5 queries.
I have tried to optimize the performance by reducing the columns in each table, but that did not improve anything, so I am quite sure it is the function calling the API which is extremely slow. When I call the API in another system it is not that slow.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.