Forum Discussion
Replace custom SQL datasource with dataflow
I identified the solution to this issue.
To recap: you have multiple published workbooks. Each uses the same custom SQL-based datasource. Each has multiple tabs, with mulitple visuals on each tab. Since they use the same datasource, it would be more efficient to publish the datasource as a dataflow and then use that in each of the workbooks as the datasource. The refresh procedure then only has to interact with your database once to refresh the data. And if this is a standardized dataset, you only have to make an update in one place (the dataflow) if the logic changes, instead of having to update multiple workbooks and republish them.
The question is how to replace the existing visuals' reference to the SQL-based datasource, with a reference to the new dataflow. Without having to rebuild each visual from new with a reference to the dataflow. In my case it was over 100 visuals between 3 workbooks, which would be very time-consuming.
The answer:
1. Publish the datasource as a dataflow.
2. Open the workbook on your desktop and bring the dataflow in as a new datasource into your workbook.
3. Open "Advanced Editor" for the dataflow-based datasource to see the M-code.
4. Copy the M-code to notepad+ or whatever you use.
5. Open "Advanced Editor" for your original SQL-based datasource.
6. Paste the M-code from the dataflow into the Advanced Editor. (if you look, you'll see the M-code is now different).
7. Close the advanced editor window and let the workblook update its data.
Your workbook is now leveraging the published dataflows, and you did not have to rebuild the visuals or make any changes to it. You should be able to close out the "new" dataflow datasources you brought into the workbook, leaving only the original datasources (but these now leverage the published dataflow).
While each workbook will still have its own dataset in Power BI Server, and you still need to refresh them, they are connecting to the dataflow when they refresh. And you will have to set up an automated refresh of the dataflow as well (if that is needed). But this solution will only leverage the database once, instead of multiple times.
One item to note: some of my visuals used an advanced filter of where a field was "not blank". The new dataflow was generating different results for those visuals. I opened the filters in question, changed from advanced to basic filter, and then unchecked the "blank" or "null" option. That gave me the correct result(s).
Hope the above helps others in this community. This forum has been very helpful to me, and I am happy to give back.