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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jaryszek
Resident Rockstar
Resident Rockstar

Adding R code bug

hi Guys,

I am getting:

jaryszek_0-1748603281663.png


after implementing this R code:

jaryszek_1-1748603306515.png


why ? what is happening with my bpip project file?

 full error details:
https://sharetext.io/75f510ff 

Best,
Jacek

 



1 ACCEPTED SOLUTION
v-pgoloju
Community Support
Community Support

Hi @jaryszek,

 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

Please find below documentation link to get data from R script

Run R scripts in Power BI Desktop - Power BI | Microsoft Learn

 

Try this code:

env_value <- Sys.getenv('COSTMGMT_CONFIG_SOURCE_PATH')
df <- data.frame(Path = env_value)
df

 

If this information was helpful, kindly mark the response as accepted and give it a thumbs-up, so it may assist others as well.

 

Best regards,
Prasanna Kumar

View solution in original post

6 REPLIES 6
v-pgoloju
Community Support
Community Support

Hi @jaryszek,


Just a gentle reminder has your issue been resolved? If so, feel free to share the solution that worked for you, or let us know if you found a different fix.

This helps close the loop on your query and supports others in the community who might face similar challenges.

Thank you for your time and feedback!

Best regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @jaryszek,

 

We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.

 

Warm regards,

Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @jaryszek,

 

Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.

 

Best regards,

Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @jaryszek,

 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

Please find below documentation link to get data from R script

Run R scripts in Power BI Desktop - Power BI | Microsoft Learn

 

Try this code:

env_value <- Sys.getenv('COSTMGMT_CONFIG_SOURCE_PATH')
df <- data.frame(Path = env_value)
df

 

If this information was helpful, kindly mark the response as accepted and give it a thumbs-up, so it may assist others as well.

 

Best regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @jaryszek,

 

Thank you for reaching out to the Microsoft Fabric Forum Community.


The issue arises because R script code was manually inserted into the .tmld file of your Power BI Project (PBIP), which is not the correct or supported way to integrate R in Power BI. This causes the error "Multiple SaveChanges without transaction" due to inconsistent or invalid metadata edits. To resolve the issue, remove the manually added R.Execute code from the .tmld file, and instead add your R script using the “Get Data > R Script” option within Power BI Desktop. This ensures that Power BI handles the metadata and transactional integrity correctly. If the project remains corrupted, revert to a previous working version of the PBIP project.


If this information was helpful, kindly mark the response as accepted and give it a thumbs-up so it can assist others as well.

 

Best regards,
Prasanna Kumar

What should be a format for my query then?

Source = R.Execute(
"env_value <- Sys.getenv('COSTMGMT_CONFIG_SOURCE_PATH')
df <- data.frame(Path = env_value)
output <- list(df = df)",
null
),

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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