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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Vmartin002
Frequent Visitor

R-Visual Uploading to Power BI Server & Custom Visual Security Concern

Hi, 

 

I've developed an R-Script (ggplot as the plotting tool and the rest of the packages are accepted by Power BI) to be used by Power BI's R-Visual Script Visual, however, I'm having an error when publishing it to my workspace on the Power BI server. The R-Script works on my desktop fine so I believe that Power BI's R-Visuals limitations aren't being violated. Any idea of what the issue might be? Also, a potential workaround I saw on the internet is to create a custom visual using Power BI visuals SDK, does this approach lead to any data-leakage or pose any data security issues?

 

Thank you,

Val

Error.PNG

10 REPLIES 10
v-kkf-msft
Community Support
Community Support

Hi @Vmartin002 ,

 

Does you use RLS in the report? Could you please share your R script and sample data? That helps us solve the problem faster.

 

Best Regards,
Winniz

 

I re-wrote my r-script and now I have a new issue shown below:Error_R.PNG

Thank you for replying! @lbendlin I'll post the solution once I arrive to it *fingers crossed* haha

@v-kkf-msft @lbendlin 

Thank you for all the help.

any tips? attached is my r-script:

library(dplyr)
library(tidyr)
library(ggplot2)
library(plotly)
library(RColorBrewer)

proposal_project = unique(dataset[["Project_Description"]])

df <- dataset %>% select(ProjectName, Commodity, Months, RTPercentCompleteV2) %>% distinct()

df <- df %>% group_by(ProjectName, Commodity, RTPercentCompleteV2) %>% slice(which.max(Months)) %>% arrange(Months)pctcomplete <- seq(0.1, 1, by=0.05)
df <- df %>% group_by(ProjectName, Commodity) %>% group_modify(~ {approx(.x$RTPercentCompleteV2, .x$Months, xout=pctcomplete) %>% data.frame()}) %>% ungroup()
prop_df <- df %>% filter(ProjectName == proposal_project) # split out proposal data after transformations
df2df <- df %>% filter(ProjectName != proposal_project)


data_wo_proposal <- df2df %>% group_by(Commodity,x) %>% summarise_at(vars(y),list(mean_duration = mean))
mindiff <- min(c(0))
maxdiff <- max(c(max(data_wo_proposal$mean_duration, na.rm=TRUE), max(prop_df$y, na.rm=TRUE)))
ticks <- round(seq(mindiff, maxdiff, by=2))
tick_y <- seq(0,100, by=5)
g <- ggplot(data=data_wo_proposal, aes(x=mean_duration, y=x, colour=Commodity)) + geom_line(linetype=2) + geom_point()
final_plot <- g + geom_line(data = prop_df, aes(x=y,y=x,colour=Commodity)) + geom_point(data=prop_df,aes(x=y,y=x,colour=Commodity))
final_plot_label <-
final_plot + labs(title='Average Duration of Reference Projects vs Proposal Project', subtitle=paste('Proposal Project:',prop_df$ProjectName[1], '(solid line in figure below)'), x= 'Duration (Months)',y='Percent Complete') + theme_bw() + theme(legend.position='bottom', legend.title=element_blank()) + scale_colour_brewer(palette='Set1') + scale_x_continuous(breaks=ticks)+scale_y_continuous(labels = scales::percent_format(accuracy = 1),breaks=seq(0,1, by=.05))
final_plot_label

lbendlin
Super User
Super User

I downloaded the sample PBIX from MSFT and was able to render the visual on my Power BI server. As for tenant/capacity it's managed tenant with Pro License.

lbendlin
Super User
Super User

Is your personal  (not Enterprise) Power BI gateway up and running?  It is required for R and Python scripts/visuals in the service.

Also, it stating that I don't need a gateway because the dataset and all data sources are on the cloud.

Hi, 

I don't know, is there a way to check? Thank you for the reply. 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.