Forum Discussion
Column created in a table appears in another table
- 8 months ago
Hi v-priyankata ,
We had a procedure on dataset that would bind the columns they created dynamically to table or custom table, we had to point it to custom table in that procedure which could be one of the root cause of the issue,(So the code was trying to add to new table and the procedure pointed to old table and when we refreshed the dataset it would appear in 2 tables) anyways we are currently not facing the duplicate column issue for now after we changed the procedure to point to new table, but we are not sure if it would happen anytime again.
Hi ChetanK004,
This behaviour is related to how Microsoft.AnalysisServices.Tabular manages object references in the Tabular Object Model (TOM). When you add a column to a table, the change is applied to the in-memory model, and then persisted when you call Model.SaveChanges(). If columns appear in another table, it usually indicates one of the following:
Please, look at steps bellow an try:
Root Causes
- Shared or cloned references
- If pbiColumns is referencing the same ColumnCollection object for both tables due to incorrect initialisation or reuse of objects, adding a column will affect both.
- This can happen if the tables were cloned or created from the same object without deep copying.
- Model refresh behaviour
- After publishing, the service may apply schema changes during refresh, merging metadata from the original source and your custom changes.
- If the original table and the custom table share the same Source or LineageTag logic, the refresh can propagate columns unexpectedly.
- Intermittent timing
- When changes are made immediately after publishing, the model may not have fully synchronised with the service, causing delayed appearance of columns.
Recommended Fixes
Ensure unique references
var pbiTable = database.Model.Tables
.FirstOrDefault(x => x.Name.Equals(tableName, StringComparison.OrdinalIgnoreCase));
if (pbiTable == null)
throw new Exception($"Table {tableName} not found.");
var pbiColumns = pbiTable.Columns;database.Model.SaveChanges();Please mark it as the accepted solution. This helps other community members find the quickest path and saves them from another endless loop 🌀.