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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ksicard2430
Helper I
Helper I

Refresh Preview - Unexpected Error: An item with the same key has already been added

Hello Power BI community,

 

I could use some help in trouble shooting the source of an error I am receiving. I am developing a large reporting system in Power BI and today I decided to refresh the Preview's for all of my queries. It's unknown to me why I am receiving the below error as all of these queries were working without issue previously. 

 

ksicard2430_0-1604678631392.png

ksicard2430_1-1604678645369.png

Almost all of my queries are receiving this error. After googling the error it seems that there may be duplicate keys. This does not make sense to me as all of these queries were working previously without issue and no changes have been made to the data sources.

 

1. I am running the most current version of Power BI Desktop

2. The data sources are tables and views within my SQL Database

3. I am able to refresh the report in Power BI Service via a data gateway without issue

 

If I do have duplicate keys like the error is mentioning, what exactly is this referring to? I am able to open the saved PBiX file and change the columns in power query prior to hitting refresh preview if this will allow for a fix. I also have control over the SQL environment if changes need to be made within the data source.

 

Any information to get me going in the right direction would be most appreciated!

 

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

If you open the advanced editor and copy the M code, and paste it into a new blank query, does that query get the error too?  I wonder if something behind the scenes of the existing tables got corrupted somehow.

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


After some additional testing I am noticing the below.

 

Within the Power Query Editor if I disable Load to Report in the properties menu for each query and then re-enable the setting allows me to successfully refresh my queries without issue. However, all of my measures and calculated columns will have to be re-built. This is an extensive amount of work, but you may be correct in that something on the back end of the power query was corrupted with this PBI report.

 

Does anybody have any ideas on how to get around this issue without a full re-build of my measures and calculated columns?

 

I don't have more to offer on the issue; haven't seen it but glad you found a workaround.  If you can open the pbix, you can create a separate measures table and move your measures there, and at least copy your column expressions out.

 

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


Pat,

 

After conducting the test you just mentioned it is indeed returing the error in a blank query.

 

ksicard2430_0-1604924755300.png

 

After pasting the M code into a blank query the query populated fine until I clicked refresh preview.

 

Are you able to provide some additional information into what this means and what route I will have to go to correct this?

 

@mahoneypat 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.