# AttributeID ... doesn't exist in the collection



## Monsignor (Dec 18, 2015)

Has anyone seen this? I'm not even sure where to start troubleshooting.


The 'AttributeRelationship' with 'AttributeID' = 'Week Start Date (Month Index)' doesn't exist in the collection.


----------



## What3vr (Jan 6, 2016)

Having the exact same problem.  The only solution I have had was to go back to a backup and re create the pivot table....  Frustrating.  Did you have any luck fixing this?


----------



## Monsignor (Jan 7, 2016)

Nope. No answer. Like you, I ended up re-doing it all.


----------



## akice (Feb 17, 2017)

I just ran into this problem today.  What happened in my case is Power Pivot in its infinite wisdom decided to be smarter than me and try to automatically help me out.  When i put a date field in a Row/Column, Excel/Power Pivot automatically added some custom columns to my data table - in my case it added "Period_End_Date (Month Index)" which thew the error just like the OP (along with "Year", "Quarter", and "Month Name" and a few more columns).  I went in and deleted all the columns giving errors from PQ refresh and it worked.  Agreed it was quite annoying.


----------



## irfanzck (Nov 9, 2020)

Monsignor said:


> Has anyone seen this? I'm not even sure where to start troubleshooting.
> 
> 
> The 'AttributeRelationship' with 'AttributeID' = 'Week Start Date (Month Index)' doesn't exist in the collection.


Hi,

I faced similar issue and finally got a fix to it. In my case what I could Identify was that in the main data table there were some cells with numbers as decimals. I identified such integers and replaced those with whole numbers and this issue got fixed. 
Hope this may be of helpful.

Regards
Irfan


----------



## CarlosDuran (Sep 21, 2021)

Solution
I have had the same problem, I am importing a folder with several excel files using PowerQery ... the problem occurs when I change the structure of the source files (number of columns).

As I understand it, Excel uses automatic grouping in dates within dynamic tables, this grouping generates indexes in the data model.
 when you changes the column number in source files, Excel loses the date index position.

my solution was to create two separate queries in PQ
I handle dates, documents and articles, which represent my key fields

my first query uses only the date and the document, and I apply them distinct rows

So I import to the data model a table with unique documents and date, ins in that table where Excel will deposit the indices for the calculation of months, quarters and years

later I create the query with all the other fields (excluding the date field) and append it to the data model.

Already in the data model the relationship between both queries based on the document field is created

In dynamic tables I use the dates from the date query and the other fields from the other query. So no matter if I alter the structure of the source files, the dates and their indexes are respected


I hope I have been clear and can serve you


----------

