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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
data_edifyedu
Regular Visitor

Script Runtime Error without description

I've created an R Visual as a table, and works pretty well in other report pages. But, this particular one, is not working when it goes to the service.

 

The error message doesn't tell much about it. Please help.

 

Activity ID: 35676b45-4406-4626-b44a-a02dab4a65fa
Request ID: 152a27e0-5d00-7f05-9878-bc74a0840dbc
Correlation ID: 15372a93-ace6-a6c7-8051-d1a224390f85
Time: Fri Aug 20 2021 11:12:14 GMT-0300 (Brasilia Standard Time)
Service version: 13.0.16577.55
Client version: 2108.1.07315-train
Cluster URI: https://wabi-brazil-south-b-primary-redirect.analysis.windows.net/

 

R Script Below

library(gridExtra)
library(grid)

percent <- function(x, digits = 2, format = "f") {
paste0(formatC(100 * x, format = format, digits = digits), "%")
}


geral<-dataset
geral <- geral[!(is.na(geral$Ticket_Médio_Meta_YTD)),]
geral[is.na(geral)] <- 0
geral$Deals_ROL_Ganho_Ac <- cumsum(geral$Deals_ROL_Ganho)
geral$Deals_ROL_Meta_Ac <- cumsum(geral$Deals_ROL_Meta_YTD)
geral['Ating_Meta_Mensal']<-geral$Deals_ROL_Ganho/geral$Deals_ROL_Meta_YTD
geral['Ating_Meta_Ac']<-geral$Deals_ROL_Ganho_Ac/geral$Deals_ROL_Meta_Ac
geral['Gap_Meta_Mensal']<-geral$Deals_ROL_Ganho-geral$Deals_ROL_Meta_YTD
geral['Gap_Meta_Ac']<-geral$Deals_ROL_Ganho_Ac-geral$Deals_ROL_Meta_Ac
geral[is.na(geral)] <- 0
geralt<-as.data.frame(t(geral))
rnames<-c('Meta Mensal', 'Realizado Mensal', 'Gap Mensal',
'Meta Acum.', 'Realizado Acum.', 'Gap Acum.',
'Forecast', 'Ticket Médio', 'Meta Ticket Médio',
'% Atingimento Mensal', '% Atingimento Acumulado')
meses<-as.character(geralt[1,])
ROL<-as.numeric(geralt[2,])
ROLMeta<-as.numeric(geralt[3,])
Forecast<-as.numeric(geralt[4,])
TM<-as.numeric(geralt[5,])
TMMeta<-as.numeric(geralt[6,])
ROLAc<-as.numeric(geralt[7,])
ROLMetaAc<-as.numeric(geralt[8,])
AtingMesc<-as.numeric(geralt[9,])
AtingAc<-as.numeric(geralt[10,])
GapMes<-as.numeric(geralt[11,])
GapAc<-as.numeric(geralt[12,])
Final <- as.data.frame(rbind(meses,
ROLMeta, ROL, GapMes,
ROLMetaAc, ROLAc, GapAc,
Forecast, TM, TMMeta,
AtingMesc, AtingAc))
colnames(Final)<-unlist(Final["meses",])
Final <- Final[!row.names(Final)=='meses',]
rownames(Final) <- rnames
Final[1,] <- format(round(as.numeric(Final[1,]), 0), big.mark=".", decimal.mark = ',')
Final[2,] <- format(round(as.numeric(Final[2,]), 0), big.mark=".", decimal.mark = ',')
Final[3,] <- format(round(as.numeric(Final[3,]), 0), big.mark=".", decimal.mark = ',')
Final[4,] <- format(round(as.numeric(Final[4,]), 0), big.mark=".", decimal.mark = ',')
Final[5,] <- format(round(as.numeric(Final[5,]), 0), big.mark=".", decimal.mark = ',')
Final[6,] <- format(round(as.numeric(Final[6,]), 0), big.mark=".", decimal.mark = ',')
Final[7,] <- format(round(as.numeric(Final[7,]), 0), big.mark=".", decimal.mark = ',')
Final[8,] <- format(round(as.numeric(Final[8,]), 0), big.mark=".", decimal.mark = ',')
Final[9,] <- format(round(as.numeric(Final[9,]), 0), big.mark=".", decimal.mark = ',')
Final[10,] <- percent(as.numeric(Final[10,]), digits = 1)
Final[11,] <- percent(as.numeric(Final[11,]), digits = 1)

Final['Indicadores']<-rnames

dfFinal <- as.data.frame(Final)
dfFinal <- dfFinal[, c('Indicadores',meses)]
dfFinal <- as.data.frame(apply(dfFinal,2,function(x)gsub('\\s+', '',x))) #Limpa em branco
dfFinal['Indicadores']<-rnames

cols <- matrix("black", nrow(dfFinal), ncol(dfFinal))
for (i in 1:nrow(dfFinal)) {
for (j in 2:ncol(dfFinal)) {
if (dfFinal[i,j] < 0) {
cols[i,j]<-'red'
}}}
 
tg<-tableGrob(dfFinal,
theme=ttheme_default(
core=list(
bg_params = list(fill=c("grey95",'white')),
fg_params = list(fontsize=24, col = cols),
padding=unit.c(unit(10, 'mm'), unit(10,'mm'))
),
colhead = list(
padding=unit.c(unit(35, 'mm'), unit(10,'mm')),
bg_params=list(fill="grey90", col="grey90"),
fg_params = list(fontsize=26, fontface="bold")
),
),rows = NULL)
tab <- gtable_combine(tg)
grid.newpage()
grid.draw(tab)
2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @data_edifyedu

 

Please check R packages that are supported in Power BI and requirements and limitations of R packages in the following link.

https://docs.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

lbendlin
Super User
Super User

Do you use a personal gateway and have you confirmed that your R packages are all supported by the gateway version you are running?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors