Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a report with an R visual that I have published to the Service. Everything works correctly in Desktop (2.91.884.0 64-bit (March 2021)), but in the Service it seems to be not pulling in any of the data.
In fact, a user was showing it to me today and I noticed that the data was incomplete, but by the time I ran it on my own browser all of the data is missing. The plot still comes up, just without data points.
This is what it should look like (from PBI Desktop):
This is what it looks like in the browser:
I'm pretty sure this was working in the service through yesterday, but I can't be certain when the last time I looked at it in the service was.
R Code is attached for reference. Is there a way to debug the code once it's in the Service so I can figure out what's going on?
Thanks!
David
ETA: I updated PBI desktop to the most recent version (May 4) and published, but the same behavior happened.
Hi @dedelman_clng ,
In the service, not all of the R packages are supported. The Power BI service applies a sandbox technology to protect users and the service from security risks, this sandbox approach imposes some restrictions on the R scripts running in the Power BI service.
document link:
You could check if your packages are available on service side in the following link: Learn which R packages are supported - Power BI | Microsoft Docs
If the problem is still not resolved, please provide detailed error information and let me know immediately, looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-henryk-mstf -
The 3 packages I'm using are
library(tidyverse)
library(ggrepel)
library(ggpubr)
tidyverse is version 1.2.1; R Studio says that ggrepel and ggpubr were built under R v3.5.3
There are no error messages that I am getting. As you can see from the screenshots in the original post, ggplot creates the plot base correctly, and the final line of my code
geom_vline(xintercept=2.5, linetype=2) + geom_hline(yintercept=2.5, linetype=2)
is executed correctly. The issue is with how it is interacting with the dataset.
I think I have narrowed it down to possibly the "filter" function. My original code looks like this:
maxAD <- max(as.character(dataset$`Analysis Date`))
minAD <- min(as.character(dataset$`Analysis Date`))
#Convert some factors into character
dataset <- dataset %>% mutate(AnalysisDt = as.character(`Analysis Date`),
`Risk Status` = as.character(`Risk Status`),
`Yr-Qtr` = as.character(`Yr-Qtr`))
So far so good. If I feed dataset into the ggplot commands at the end I get a scatter plot as desired.
dataset %>%
mutate(LBL=paste(`Risk ID`,": ",ShortName, sep="")) %>%
mutate(Sz = `Residual Total Score`)
ggplot(aes(x=`Res Like Score`, y=`Res Sev Score`))+
geom_point()
The next line of code is this
dsTQ <- dataset %>%
filter(AnalysisDt == maxAD) %>%
filter(`Residual Total Score` >= 12 | `PQ Res Score` >= 12)
This should filter dataset down to 8 rows. When I put dsTQ into the plotting code
dsTQ %>%
mutate(LBL=paste(`Risk ID`,": ",ShortName, sep="")) %>%
mutate(Sz = `Residual Total Score`)
ggplot(aes(x=`Res Like Score`, y=`Res Sev Score`))+
geom_point()
On the desktop it looks like this
But once it gets to the service I get this
So something in the "filter" function is leading to an empty data set in the Service. Or possibly when maxAD and minAD are set.
Is there a way to debug the R scripts that are actually being run in the Service?
Thanks
David
@v-henryk-mstf - I have discovered another piece of the puzzle. I took the code that created dsTQ and commented out the reference to `Residual Total Score` and `PQ Res Score`
dsTQ <- dataset %>%
filter(AnalysisDt == maxAD) #%>%
#filter(`Residual Total Score` >= 12 | `PQ Res Score` >= 12)
Then I plotted this dsTQ with the simple plot
dsTQ %>%
ggplot(aes(x=`Res Like Score`, y=`Res Sev Score`))+
geom_point()
and got the expected correct results in the Service
So the problem appears to be using the "filter" function, with a column name being quoted by backwards apostrophe ( ` ). Since the functionality works correctly on Power BI Desktop, I can only infer that there is a problem in how the Power BI Service compiles and runs R code.
Please let me know if I need to enter this behavior as a support ticket in order to get a bug registered, or if it can be entered as a bug directly from this thread.
Thanks
David
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.