Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

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



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,



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,


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:


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))

Super User III
Super User III

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.

Super User III
Super User III

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.


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

Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors
Top Kudoed Authors