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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors