Forum Discussion
Strange circular dependency maybe needs row idnefier
- 6 years ago
yes this is all done through Power Query.
I think I found the answer which is quite bizarre.
In my original table the first column say was [Customer No_] in the database. I then renamed this to [Customer No] in PQ. On upload this is the first column in Data View and I assume Power BI treats this as the row identifier?
Whne i changed the source query to SQL I thought I would do the renamingon import so wrote
[Customer No_] AS [Customer No]
However Power Bi thinks this is a new column and put it at the end of the data view like it would do if you ammended the Power Query and added a column or if you add calcuated columns. This is completely mad as the name of the column is identical and created in the source step. The problem is now my first column in data view is a non-unique column so lots of my calculated columns now have circular errors. This is not fixable as Power BI does not have the abilty to specifc a column as the row identifier.
Luckily I found the solution. DO NOT rename an SQL column in the SQL SELECT statement. If you SELECT is as [Customer No_] and do theremane in Power Query it sees this as the same column already exisitng and leaves it at the front of Data view. All the formulae work fine. Probably it's just the column that is the unique row identifier that must not be renamed in SQL.
Took me 3 days to work this out. Really stupid bug.
Hi masplin ,
I would recommend Power Query, although I consider myself an SQL expert.
Power Query is more readable to other users and can be applied to a variety of sources.
Performance can be improved by the correct order of steps.
Do you know the Power Query option "View native query"?
Yes, SQL is faster, but speed is not everything.
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
- masplin6 years ago
Power Participant
yes this is all done through Power Query.
I think I found the answer which is quite bizarre.
In my original table the first column say was [Customer No_] in the database. I then renamed this to [Customer No] in PQ. On upload this is the first column in Data View and I assume Power BI treats this as the row identifier?
Whne i changed the source query to SQL I thought I would do the renamingon import so wrote
[Customer No_] AS [Customer No]
However Power Bi thinks this is a new column and put it at the end of the data view like it would do if you ammended the Power Query and added a column or if you add calcuated columns. This is completely mad as the name of the column is identical and created in the source step. The problem is now my first column in data view is a non-unique column so lots of my calculated columns now have circular errors. This is not fixable as Power BI does not have the abilty to specifc a column as the row identifier.
Luckily I found the solution. DO NOT rename an SQL column in the SQL SELECT statement. If you SELECT is as [Customer No_] and do theremane in Power Query it sees this as the same column already exisitng and leaves it at the front of Data view. All the formulae work fine. Probably it's just the column that is the unique row identifier that must not be renamed in SQL.
Took me 3 days to work this out. Really stupid bug.