Forum Discussion

Vmartin002's avatar
Vmartin002
Frequent Visitor
5 years ago

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

10 Replies

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

    • Vmartin002's avatar
      Vmartin002
      Frequent Visitor

      Hi, 

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

    • Vmartin002's avatar
      Vmartin002
      Frequent Visitor

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

    • Vmartin002's avatar
      Vmartin002
      Frequent Visitor

      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.

  • v-kkf-msft's avatar
    v-kkf-msft
    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

     

    • Vmartin002's avatar
      Vmartin002
      Frequent Visitor

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

      • Vmartin002's avatar
        Vmartin002
        Frequent Visitor

        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