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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Error while adding R/Python script to a powerquery step !

Source data is obtained by combining 4 different tables and even after adding the R script in indidual tables also lead to same error

While adding R/python script to the PowerQuery steps, the following error occurs :
Abhishek2023_2-1691582938666.png

 

Although there is way by changing privacy settings to public but it is forbidden for security reason. But there is another way suggested by invoking a function (https://sqlitybi.com/formula-firewall-error-referencing-queries-r-python-scripts/)
 
This also leads to same error
Abhishek2023_3-1691582956885.png

 

The root cause might be that the resulting table is obained by appending tables. But PowerBI treats as if the table/data is from external source. Even tried to add R script to individual tables but still leads to same error as above.
2 REPLIES 2
Anonymous
Not applicable

Thanks for descriptive suggestions.
1. Each file/source privacy set to 

Abhishek2023_0-1691661693819.png

2. Not allowed to make public

3 & 6. PowerQuery and Datamart had np possibility to embed R scripts

4. Actually here we are just combining 4 tables but invoke didnt work
5. No external data source involved. Just extracting data from sharepoint into PowerBI and former has no possibility of extracting text via regular expressions

Syndicate_Admin
Administrator
Administrator

Here are some steps you can take to troubleshoot and resolve this issue:

  1. Check Privacy Levels: Ensure that the privacy levels for the data sources you're combining in your Power Query are correctly configured. Each data source has a privacy level, and data from sources with different privacy levels can't be combined in the same query.

  2. Modify Privacy Levels: If you're combining data from different data sources with different privacy levels, you might need to adjust the privacy levels to allow data to be combined. You can do this by going to "File" > "Options and settings" > "Options" > "Privacy" in Power BI Desktop.

  3. Check for DirectQuery Mode: If you're using DirectQuery mode for any of your data sources, it might lead to privacy issues with scripting. Power Query scripting might not work well with DirectQuery mode.

  4. Invoke Custom Functions: As you mentioned, invoking custom functions in Power Query could be a workaround. However, the effectiveness of this approach depends on the nature of your data and scripts. If the tables you're appending are derived from similar data sources, the custom function might work.

  5. External Tools or Preprocessing: If privacy settings are restricting your ability to use scripting, consider preprocessing your data outside of Power BI using R or Python scripts. You can use external tools to clean, transform, and preprocess your data before bringing it into Power BI.

  6. Advanced Dataflows: If your data is complex and privacy settings are causing issues, consider using Power BI Dataflows. Dataflows allow for more advanced ETL processes, and you can use Power Query Online (Mashup) as well as scripts like R and Python in dataflows.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors