Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JamesDBartlett3/37b0ae555cf8f92563a92719a556c907 to your computer and use it in GitHub Desktop.
Save JamesDBartlett3/37b0ae555cf8f92563a92719a556c907 to your computer and use it in GitHub Desktop.
Run this script in Tabular Editor to replace the source Dataflow GUIDs in your Power BI Dataset
// This script is used to change the DataflowID & WorkspaceID on all partitions in the model
var oldWorkspaceId = "";
var newWorkspaceId = "";
var oldDataflowId = "";
var newDataflowId = "";
// Loop through all partitions on the model, replacing the DataflowIDs & WorkspaceIDs
foreach(var p in Model.AllPartitions.OfType<MPartition>())
{
p.Expression = p.Expression
.Replace(oldWorkspaceId, newWorkspaceId)
.Replace(oldDataflowId, newDataflowId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment