Forum Discussion
Data Refresh Fails, Error message claims duplicate ID value in table
Hello!
I am having the same issue where I query data from app insights with
Web.Contents("https://api.applicationinsights.io....
Data is fetched into a tables which contain one row per day having the date as a unique column set in the model. All tables also have 1:1 relation to a date-table which is the date master table.
When refreshing with Power BI desktop, everything works as expected. When doing a scheduled (incremental) refresh in the cloud, it fails with error:
Column '<pii>Date</pii>' in Table '<pii>SomeTable</pii>' contains a duplicate value '<pii>10/1/2021</pii>' and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table.
This is 100% deterministic and it fails always on the same date (10/1/2021).
I tried to make the Date column non-unique and changed the relation to be 1:*. This made the scheduled update work but the data was wrong since I had to apply a sum() function to get 1 row per day. 10/1/2021 was x2 then.
One observation I made:
When setting incremental refreshs to.
refresh: 1 month
detect changes: Date column
The error is deterministic with 10/1/2021 occuring twice.
If I change to
refresh: 2 weeks
detect changes: Date column
The error occurs with other dates (more than 1). In fact a series of 5 days is x2.
I, of course, checked the result by querying directly in app insights. The data is correct with no duplictate rows.
Regards,
Gernot
It turned out to be my own fault. The way, I wrote the query was inclusive on both sides so on a new refresh, it also returned the last record from the previous iteration.