Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I'm testing R visual in PowerBI (I'm a beginner in R). I use map files from an external direectoy which works fine in PowerBI Desktop. However, after uploading the report into PowerBI, I can't access my local files. Not sure how to access these files from PowerBI Service? Could I get them from OneDrive?
I set the files directory this way in my R code:
Any help would be welcome.
Many thanks
If you're ok with using an R script as a query source , you could import the shapefile in an R query and convert the geometry into a well known text (wkt) column (using the sf package's st_as_text() function). This stores the geometry as plain text for each feature.
R Script Query example
library(sf)
shp <- st_read(shapefile)
shp$wkt <- st_as_text(shp$geometry)
When you're ready to do the visual, you can add that wkt column from the PowerBI table to your script visual and convert it back to a spatial format by using st_as_sf(). Make sure your wkt text column is both not summarized and Show items with Missing Data is checked.
Script Visual code to convert wkt column back to sf
library(sf)
dataset_sf <- st_as_sf(dataset, wkt = "wkt", crs = 4326)
I'm assuming your shapefile is WGS84 projection (SRID 4326), but set your CRS argument accordingly to the original projection.
Note that for scheduled refresh on the PowerBI service requires a personal gateway for queries using R scripts as sources.
Hi, @Panou
You can try to change the path to the cloud, or install a personal gateway.
I am not sure about that. You can open a support ticket with MSFT to seek technical support ,they will have better suggestions.
Related document:
https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-r-in-query-editor
Best Regards,
Community Support Team _ Eason
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
21 | |
17 | |
15 | |
11 |
User | Count |
---|---|
41 | |
24 | |
22 | |
18 | |
11 |