Forum Discussion
How to Change Data Source from SQL Synapse to Kusto Without Affecting Relationships in Power BI
I want to update the data source of a table from SQL Synapse to Kusto.
I tried updating the source in the M query, but it caused the relationships to change.
Can anyone suggest how to update just the source without affecting the existing relationships?
Hi AnupTandale,
Would like to let you know that Power BI maintains relationships based on column names and data types not in the database change.
- Go to Power Query Editor.
- Select the table you want to switch.
- Go to Advanced Editor.
- Replace the SQL Synapse source with your Kusto source (using Kusto.Contents).
Example of M-Code:
SQL database (From) :
Source = Sql.Databases("your-synapse-server"), DB = Source{[Name="your-db"]}[Data], Table = DB{[Schema="dbo",Item="your-table"]}[Data]Kusto database (To) :
Source = Kusto.Contents("https://yourcluster.region.kusto.windows.net"), DB = Source{[Name="your-db"]}[Data], Table = DB{[Name="your-table"]}[Data]Makesure that the output from Table matches the original table exactly (column names and data types). Also, Keep the Power BI query/table name the same as before. Renaming it will break relationships and measures referencing it.
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.Hi AnupTandale
This is expected behavior when changing the data source, especially when switching between different source types like SQL Synapse and Kusto. Power BI handles each table individually, so you’ll need to update the source for each table separately.
Make sure that:
-
The structure of the tables remains exactly the same
-
Column names and data types match the original
-
You re-check the Power Query (M) steps for each query after the source change
Even if everything looks similar, relationships and schema mapping may break. Unfortunately, there’s no “magic fix” — it often requires reviewing each table one-by-one and validating the model.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
-
6 Replies
- ajaybabuinturiSuper User
Hi AnupTandale,
Would like to let you know that Power BI maintains relationships based on column names and data types not in the database change.
- Go to Power Query Editor.
- Select the table you want to switch.
- Go to Advanced Editor.
- Replace the SQL Synapse source with your Kusto source (using Kusto.Contents).
Example of M-Code:
SQL database (From) :
Source = Sql.Databases("your-synapse-server"), DB = Source{[Name="your-db"]}[Data], Table = DB{[Schema="dbo",Item="your-table"]}[Data]Kusto database (To) :
Source = Kusto.Contents("https://yourcluster.region.kusto.windows.net"), DB = Source{[Name="your-db"]}[Data], Table = DB{[Name="your-table"]}[Data]Makesure that the output from Table matches the original table exactly (column names and data types). Also, Keep the Power BI query/table name the same as before. Renaming it will break relationships and measures referencing it.
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues. - Ritaf1983Super User
Hi AnupTandale
This is expected behavior when changing the data source, especially when switching between different source types like SQL Synapse and Kusto. Power BI handles each table individually, so you’ll need to update the source for each table separately.
Make sure that:
-
The structure of the tables remains exactly the same
-
Column names and data types match the original
-
You re-check the Power Query (M) steps for each query after the source change
Even if everything looks similar, relationships and schema mapping may break. Unfortunately, there’s no “magic fix” — it often requires reviewing each table one-by-one and validating the model.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
-
- Elena_KalinaSolution Sage
Hi AnupTandale
To change your data source from SQL Synapse to Kusto (Azure Data Explorer) without affecting existing relationships in your Power BI model, follow these steps:
Recommended Approach
1. Use Power Query Editor to Update the Source
Open Power Query Editor (Home > Transform data)
Locate the table you want to modify
Right-click the "Source" step in the Applied Steps pane
Update the connection details to point to your Kusto cluster instead of Synapse
2. Preserve Column Structure (Critical for Relationships)
Ensure the new Kusto query returns exactly the same column names and data types as your original Synapse query
Verify that:
Key columns used in relationships have identical names
Data types match (especially for join columns)
Column order remains the same
3. Alternative Method - Parameterize the Source
Create parameters for connection details:
// In Power Query Editor > Manage Parameters KustoCluster = "your-cluster-name", KustoDatabase = "your-database-name"
Modify your source step to use the parameters:
Source = Kusto.Contents(KustoCluster, KustoDatabase, "YourTable")
Troubleshooting Relationship Issues
If relationships break after changing the source:
Check for hidden changes:
Verify no columns were inadvertently renamed
Confirm no data type conversions occurred
Re-establish relationships manually if needed:
Go to Model view
Drag between key fields to recreate relationships
Verify cardinality and cross-filter direction match the original
Best Practices
Make a backup of your PBIX file before making changes
Test with one table first before converting all data sources
Document your relationships beforehand for easy verification
Consider using calculation groups if you need to maintain compatibility with both sources during transition
Common Pitfalls to Avoid
Changing column names or data types during migration
Altering the query structure significantly (adding/removing columns)
Forgetting to update authentication credentials for the new source
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you.
- AnonymousNot applicable
Hi AnupTandale
Thankyou ajaybabuinturi Elena_Kalina Ritaf1983 for taking time and providing solution.
we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.Regards,
Akhil. - AnonymousNot applicable
Hi AnupTandale
Just checking in to see if the solution we shared worked for you? If you're still facing any issues or need more help, feel free to let us know, we're happy to assist further.
If the response helped resolve your issue, please consider marking it as Accepted as Solution and give it a thumbs up if you found it helpful.
Thanks,
Akhil. - AnonymousNot applicable
Hi AnupTandale
Just checking in one last time. Were you able to try out any of the suggestions shared earlier? If your issue is resolved, marking the accepted solution would be a big help to others who might be facing the same scenario.
If you went in a different direction or still need support, feel free to drop a quick update, we’re happy to keep helping.
Regards,
Akhil.