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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
marta1706
Regular Visitor

R script visual not displaying correctly after PowerBI report published

I created an R script visual in my PowerBI report using PowerBI Desktop. The visual displays correctly on my end, but when I publish the report to my workspace, I get the following error:

 

marta1706_0-1723554500394.png

Other community posts suggested I might be using the wrong version of R, so I installed R 3.4.4, changed default R installation in PowerBI, and tried that. It hasn't worked because my visual uses tidyverse, and I haven't been able to install tidyverse in R 3.4.4 (I tried with the default install.packages command as well as pointing to a tar.gz file in tidyverse archive - tried version 1.2.1 and 1.3.0).

 

Is there a trick to making R script visuals work after file is published?

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

I think this can be closed now - I found a solution. After installing R 3.4.4, I manually installed all the requirements for tidyverse 1.2.1, after which I could install tidyverse 1.2.1 and use it in PowerBI. Image is now displaying correctly after publishing.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi, @marta1706 

You can visit the following link and download version 4.4.1 to install the tidyverse properly in Rstudio.

Download R-4.4.1 for Windows. The R-project for statistical computing.

vyaningymsft_1-1723617113664.png

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi @Anonymous ,

 

Thanks. I know I can do that - it's what resulted in the error message I screenshot in my post. I only tried R 3.4.4 later, because Microsoft say that this is the highest version of R compatible with PowerBI: see here.

 

Is there anything else I can do? Has anyone else had this problem?

Anonymous
Not applicable

Hi, @marta1706 

Ok, I know it, what R code you used in PBI Desktop, you can share it and we will test to find suitable solutions.

Best Regards,
Yang

Community Support Team

Hi @Anonymous ,

 

I made a few visuals, here is one example. Like I said, it all works fine in Desktop, and only generates an error after I publish to my workspace.

 

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset <- data.frame(undefined, undefined.1, undefined.2, undefined.3, undefined.4)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(tidyverse)

dataset<-dataset%>%
  rename(Category=`Supporter Giving category`)%>%
  rename(Date=`Received Date`)%>%
  filter(Amount>0)

dataset$Date2<-str_sub(dataset$Date, end=10)

dataset$Date2<-ymd(dataset$Date2)

dataset$count<-1

donors_donation_count<-dataset%>%
  group_by(py3_customer)%>%
  summarize(count=sum(count))


dataset<-left_join(dataset, donors_donation_count, by="py3_customer")%>%
  rename(count=count.x)%>%
  rename(donations_per_donor=count.y)

dataset$month<-as.character(month(dataset$Date2))

dataset<-dataset%>%
  mutate(
    month = case_when (
      month==1 ~"01",
      month==2 ~"02",
      month==3 ~"03",
      month==4 ~"04",
      month==5 ~"05",
      month==6 ~"06",
      month==7 ~"07",
      month==8 ~"08",
      month==9 ~"09",
      month==10 ~"10",
      month==11 ~"11",
      month==12 ~"12",
      .default=NA))


dataset$year<-year(dataset$Date2)

dataset$year_month<-paste(as.character(dataset$year),"-",dataset$month)

dataset2<-dataset%>%
  filter(donations_per_donor>1)

dataset2<-dataset2%>%
  select(py3_customer, year_month)

dataset2<-unique(dataset2)

ggplot(dataset2)+
  aes(x=year_month)+
  geom_bar(stat="count", fill="#ffb500")+
  labs(x="Donation month", y="Number of repeat givers", title="Repeat givers per month")+
  geom_text(aes(label=..count..), stat="count", vjust=1.5, size=6, colour="black", fontface="bold")+
  theme_light(base_size=25)
 
Anonymous
Not applicable

Hi, @marta1706 

After testing, PBI Service can view visual objects normally. Forgetting a bit about what your data is, you can share pbix files (Google Drive/One Drive) without sensitive data, screenshots, etc. to help us reproduce your problem faster. 

vyaningymsft_1-1723629833355.png

vyaningymsft_0-1723629813957.png


Best Regards,
Yang

Community Support Team

Hi @Anonymous ,

 

I think this can be closed now - I found a solution. After installing R 3.4.4, I manually installed all the requirements for tidyverse 1.2.1, after which I could install tidyverse 1.2.1 and use it in PowerBI. Image is now displaying correctly after publishing.

Hi @Anonymous ,

 

Thanks! I can also view them normally in Desktop, which is what I think you're showing me screenshots of. The error happens when the file is published to a workspace.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.