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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
viniciuscastilh
Frequent Visitor

Cache consult

Hi

I need to consult an API several times at once in order to get all the results I need But when I do that, it always pulls the same values, I believe it is because of the cache, how can I delete this cache?

Follow the base code:

 

 

(Filler as any)=>

let
    Fonte = Json.Document(Web.Contents("", [Headers=[""]])),
    results = Fonte[results],
    #"Convertido para Tabela" = Table.FromList(results, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    #"Convertido para Tabela"

 

 

Follow the funcion:

 

 

let
    N_ = 10, //update as needed
    list_ = List.Numbers(1,N_),
    res_ = List.Transform(list_, function_),
    final_ = Table.Combine(res_),
    #"Duplicatas Removidas" = Table.Distinct(final_)
in
    #"Duplicatas Removidas"

 

 


Thanks

7 REPLIES 7
mahoneypat
Employee
Employee

Are you using the (Filler as any) function in your List.Transform?  How is the Filler parameter being used in the function?  How is the list value being used in that function?  If not, you would get 10 of the same tables.

Regards,

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


The parameter is not being used, the list.Transform function is invoking the function 10 times It works sometimes, I managed to list the 500 results (10 searches out of 50), but it is a bit rare, it must have been the times that the query did not get the cache of the first.
The Filler parameter is just to be able to invoke the function, but it is insignificant

Thanks

StefanoGrimaldi
Resident Rockstar
Resident Rockstar

hey, 

here its how you could clean manually the cache on the power bi desktop: 

StefanoGrimaldi_0-1609963098687.png

on the options and settings panel, 

but I will recommend trying to separate the source API reading if its 10 times 10 files open 10 queries get the data and make a function to tranform them and them append them (if they all have the same headers). instead of reading all 10 items at once in the same run of the source. them disable the 10 queries from data load and left only the new appended query. 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




Hi
He queries 10 times to give 10 different results and to add these results in a single spreadsheet, the question that when he does the 10 times he only saves the first query Only the act of clearing the cache does not solve it because the query is all at once, I needed something in Power Query that would eliminate caches or that would have 10 different queries Actually there are not 10 consultations, but 70 to 100 consultations, this is just a test
Thanks

as far as I know you cant actually loop in a same source multiple queries in it for a unique queri as the source search for 1 record 1 query to input for source you could try another approach as creating a sharepoint repository that get this 100 consultations files from a push flow from a update request of power bi (but I think you need premiun caps for this) and them connecto to that sharepoint folder and combine all the files in it. 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




https://community.powerbi.com/t5/Desktop/Looping-through-Parameters-for-API-calling/td-p/574796 also here I found something that could be a solution for what you asking for or point you in a better direction them my answer.





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




I tried to add the following code in the Header, but still keeps saving only the first query and the rest being all the same

 

#"Cache-Control"="no-cache, no-store, must-revalidate"

 
The other time I had this problem, this code solved it, but this time it's not working

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors