cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aforsberg
New Member

R visual execution timeout in Power BI Service depending on input dataset size

I have several R visuals (R script visuals and custom R developer visuals) that throw an execution timeout error in Power BI Service. I am aware of the known limitations with R visuals (eg. 150,000 rows, 2MB, etc), but I don't think I am bumping into those limits. My scripts use the gstat package to interpolate data using ordinary kriging and I use either leaflet (custom R developer visual) or ggplot2 (R script visual) to display the results of the kriging spatially. When my input dataset increases from 179 rows to 289 rows, I get the execution timeout error. I should note that the visuals render in Power BI Desktop, but not in Service.

 

My error details:

 

Activity ID: a8a73d18-6e9d-4ab2-830d-e1f186ae0e6e
Request ID: 53c63df8-6932-4e89-bbfc-f8d35713f6f7
Correlation ID: bbd8fc2e-95b4-72e9-659f-6cc952e12f5b
Time: Tue Mar 30 2021 08:55:56 GMT-0400 (Eastern Daylight Time)
Service version: 13.0.15751.60
Client version: 2103.4.05452-train
Cluster URI: https://wabi-west-us-b-primary-redirect.analysis.windows.net/

 

R Version details:

platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 0.4
year 2021
month 02
day 15
svn rev 80002
language R
version.string R version 4.0.4 (2021-02-15)
nickname Lost Library Book

 

R script:

library(ggplot2)
library(sf)
library(dplyr)
library(gstat)
library(raster)
library(ggrepel)
library(sp)

crs <- "+init=epsg:2277"

dat <- dataset

# Rename coordinates to lat and lng for leaflet
dat <- dat %>%
rename(lat = x_coord,
lng = y_coord)

# Make spatial dataframe
coordinates(dat) <- ~lat+lng
proj4string(dat) <- CRS(crs)
dat <- dat[-sp::zerodist(dat)[,1],]

# Get extent of data
xb <- min(dat@coords[,1])
xe <- max(dat@coords[,1])
yb <- min(dat@coords[,2])
ye <- max(dat@coords[,2])
xn <- 10 # (xe - xb)/100
yn <- 10 # (ye - yb)/100

# Get number of points
n <- length(dat@coords[,1])

# Create grid and make spatial object
grid2D <- expand.grid(lat = seq(xb, xe, xn),
lng = seq(yb, ye, yn))
gridded(grid2D) <- ~lat+lng
sp::proj4string(grid2D) = CRS(crs)

# Create variogram using linear model
v <- variogram(midland_pcl_format ~ 1, dat)
v.fit <- vgm(1, 'Lin', 0)

# Krig the data
base <- gstat::krige(midland_pcl_format ~ 1, dat, grid2D, model = v.fit)

# Convert SpatialPixelsDataFrame to Raster
rpred <- raster(base)
limit1 <- 0.8
rpred[rpred <= limit1] <- NA
rppred <- projectRaster(rpred, crs = "+init=epsg:4326")
rpred_df <- as.data.frame(rppred, xy = TRUE)

ggplot () +
geom_raster(data = rpred_df, aes(x = x, y = y, fill = var1.pred)) +
scale_fill_continuous(na.value = "transparent") +
geom_point(
data = dat@Anonymous,
aes(x = longitude, y = latitude, color = as.factor(midland_pcl_format)),
size = 3
) +
scale_color_manual(values = c("0" = "#009292", "1" = "#fe6db6"))+
geom_text_repel(
data = dat@Anonymous,
aes(x = longitude, y = latitude, label = sys_loc_code),
family = "sans",
alpha = 0.7,
size = 3,
label.padding = 0.5
) +
ylab("")+
xlab("")+
theme(legend.position = "none") +
coord_quickmap()
1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @aforsberg ,

There are some known limitations of  R visual in the Power BI Service:

 

  • Data size limitations – data used by the R visual for plotting is limited to 150,000 rows. If more than 150,000 rows are selected, only the top 150,000 rows are used and a message is displayed on the image.

  • Calculation time limitation – if an R visual calculation exceeds 60 seconds the script times out, resulting in an error.

Creating R visuals in the Power BI service

 

Because you have several R visuals in the report. It is possible that the resources required to load these R scripts are insufficient in the Service, which causes a timeout error.

Try to create a test report, retain only one R visual, and then refresh to see if there is an error.

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.