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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jaryszek
Post Prodigy
Post Prodigy

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.