Forum Discussion
POST-request creates DUPLICATE records on first run
Hi crossover
If this issue exists with the query you posted, and you're not going to change anything in this query, then the issue is probably on the evaluation step of the query -- where Power BI tries to see if everything is alright before actually running it.
You could try this and see if duplicates are not added:
Or, since you actually don't want to POST anything while editing the query, use this OnTake:
- crossover5 years agoAdvocate I
Smauro thanks for that. Your suggestion on the evaluation step being the culprit looks sensible. Just a note - I'm not launching the query from Power BI, but from Excel. However as they both use PowerQuery, I assume it doesn't matter here. I tried adjusting the M-code according to your pointers and while the query still runs and data is posted to API, same problem still prevails, when input data is changed (in Excel cell), first query always posts duplicate records to API.
While I'm still intrigued on how to overcome this from technical standpoint, I managed to find a workaround. The API does accept "external ID" to be sent in POST request contents and I have added it. Data is most likely still forwarded twice, however given the same ID is provided in contents, second concurrent POST only overwrites the first record and doesn't generate duplicate records anymore. As long as ID-s are always unique, I shouldn't have problems in unwanted overwriting of data and including timestamp in the ID should take care of that.