Forum Discussion
Adding R code bug
- Anonymous1 year ago
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)
dfIf 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
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
- jaryszek1 year agoSuper User
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 ),