The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
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:
Sounds like an R script error
r - Getting the error "level sets of factors are different" when running a for loop - Stack Overflow
Thank you for replying! @lbendlin I'll post the solution once I arrive to it *fingers crossed* haha
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
Please mention which tenant/capacity you are on.
Create advanced analytics and visualizations using R scripts - Power BI | Microsoft Docs
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.
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
22 | |
11 | |
11 | |
10 |
User | Count |
---|---|
111 | |
33 | |
28 | |
21 | |
19 |