Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi guys, I hope you are well.
I created a paginated API, and when invoking it everything works perfectly. But I need to do a customer consultation, and there is a parameter that is mandatory. So when invoking the function, I used two parameters, 1st from the pagination and 2nd from the client's code, but I'm not able to make this code dynamic. I need it as it is bringing all the pages, return me all the clients as well. How can I do this?
function
let
totalpages = fx_Clientes_(1)[total_de_paginas,codigo_cliente_omie],
listOfPages = List.Generate(
() => [page = 1, data = fx_Clientes_(1)],
each [page] <= totalpages,
each [page = [page] + 1, data = fx_Clientes_([page]+1)]
)
in
listOfPages
Hi @kafreitass
You haven't been 100% clear on what it is you are trying to achieve. Please supply examples of what that is.
When you say I need it as it is bringing all the pages, return me all the clients as well. How can I do this?
What exactly do you mean? Have you got lots of pages and clients to get data for? Is that what the parameters are? if so, what values can these parameters take?
If you are trying to create a query that loops and gets data for all combinations of pages and customers, you can try storing those values in a lists. Then use List.Transform to call the function to get your data for each value in the list of customers e.g.
Customers = {"Alpha" , "Bravo" , "Charlie"},
Results = List.Transform(Customers , fx_Clientes_(Customers) )
Your code looks like it is calling the function twice, to do different things?
The first time it's getting the total number of pages for a client?
The 2nd time, (in List.Generate) it's calling the function to get data for each of those pages up to the value of totalpages?
If you are tryign to do 2 different thinsg with a single function, you should create 2 functions. 1 each to do the 2 things you want.
Regards
Phil
Proud to be a Super User!
Hi @kafreitass
Perhaps creating a parameter in PQ would be the answer to your problem
Regards
Phil
Proud to be a Super User!
@PhilipTreacythanks for answering
But from what I'm understanding this way I need to impute all the values in the parameter. And the values that will be created by the system?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
82 | |
62 | |
45 | |
41 | |
40 |