Forum Discussion
PowerBI API Integration
- 1 year ago
Hi Anonymous
Power BI reads the data at refresh time and doesn't store its historical version. Even if you buffer it in a separate query and choose not to load it, that query will still be evaluated if referenced by other loaded queries. If you want to include October data and not be pulled from API in the next refresh, you must use an external storage (excel, dataflow, another database, etc) and then append that in the query editor.
You can try below steps hope it helps.
Modify M Code for Appending:
Make sure your M code explicitly appends new data to the existing dataset. Here’s a basic example of how you might structure your M code to append data:
let
Source = Excel.Workbook(File.Contents("path_to_your_excel_file.xlsx"), null, true),
ExistingData = Source{[Name="Sheet1"]}[Data],
WebData = Web.Contents("your_web_source_url"),
NewData = Csv.Document(WebData, [Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
CombinedData = Table.Combine({ExistingData, NewData})
in
CombinedData
Buffering Data:
Buffering can help manage data in memory, but it’s crucial to ensure that the buffering step is correctly implemented. You might want to buffer the existing data before appending new data:
let
Source = Excel.Workbook(File.Contents("path_to_your_excel_file.xlsx"), null, true),
ExistingData = Table.Buffer(Source{[Name="Sheet1"]}[Data]),
WebData = Web.Contents("your_web_source_url"),
NewData = Csv.Document(WebData, [Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
CombinedData = Table.Combine({ExistingData, NewData})
in
CombinedData
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!