Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
mca69
Regular Visitor

Best practise to hide sql query code in report

Hi,

I am currently working on a model to distribute power bi reports based on desktop experience and power BI service as well. The thing is, I would like to hide the sql query code from the report, or any other solution to preserve any access to it. Mostly, I connect reports to sql server databases, on premise as well as online (azure sql database).

Anyone with answer or tip to that ?

Thanks in advance. Very much appreciated.

Regards.

2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@mca69,

 

You could create dataflows that contain SQL, and then connect Power BI Desktop to the dataflows. This would prevent users from being able to access the SQL in Power BI Desktop.

 

https://docs.microsoft.com/en-us/power-bi/transform-model/dataflows/dataflows-introduction-self-serv... 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Hi,

First of all, thank you for that particular answer. In addition to be one of the best solutions for hiding SQL script that I tried for a couple of days, I discovered a very powerful funtionnality in data modeling. Sure there must be some disadvantages to use power bi dataflows but till now I haven't find any and I think it is just the best way to model and reuse data.  

View solution in original post

3 REPLIES 3
mca69
Regular Visitor

Hi,

Thanks for the answer. I am going to investigate if dataflows could be a solution. I will let you know.

 

DataInsights
Super User
Super User

@mca69,

 

You could create dataflows that contain SQL, and then connect Power BI Desktop to the dataflows. This would prevent users from being able to access the SQL in Power BI Desktop.

 

https://docs.microsoft.com/en-us/power-bi/transform-model/dataflows/dataflows-introduction-self-serv... 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,

First of all, thank you for that particular answer. In addition to be one of the best solutions for hiding SQL script that I tried for a couple of days, I discovered a very powerful funtionnality in data modeling. Sure there must be some disadvantages to use power bi dataflows but till now I haven't find any and I think it is just the best way to model and reuse data.  

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.