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.
I'm currently using field parameters to create dynamics PowerBI graphs. Works GREAT!
And I'm using R Visual Objects to show ggplot2 graphs with PowerBI data. It works GREAT too!! I just need to add the field to the visual objetc as with any other. I.E: I add the fields 'age' and 'hour' from my PowerBI data, and refer them in my ggplot:
Hi @Francisco_G_Cal ,
Did you get any error message? Could you please share the related R script with us for the further investigation? By the way, is there any space or special character in your field parameter name? It need to be enclosed in backticks in R if the column names include spaces or special characters. The following one is the thread which has the similar problem as yours, hope it can help you resolve the problem.
r - Unable to plot ggplot graph on Power BI - Stack Overflow
library(dplyr)
df <- tibble(
incident_date = dataset$`Incident Date`,
incident_regular = dataset$`# Incident - Regular`
)
Regressor = lm(formula = incident_regular ~ incident_date, data = df)
ggplot(df) +
geom_point(aes(x = incident_date, y = incident_regular), color ='red') +
geom_line(aes(x = incident_date, y = predict(Regressor, new data = df)), color ='blue') +
ggtitle('Incident Count Prediction') +
xlab('Incident Date') +
ylab('Number of Incident')
Best Regards
I have no problem for drawing my ggplot in R.
Theese are the vars I add to the R Script Object
The last one, 'Numericas', is a FIELD PARAMETER
This is my code (the commented lines are created by PowerBI)
# El código siguiente, que crea un dataframe y quita las filas duplicadas, siempre se ejecuta y actúa como un preámbulo del script:
# dataset <- data.frame(Accesos, Edad, Hora)
# dataset <- unique(dataset)
# Pegue o escriba aquí el código de script:
library(ggplot2)
color_palette <- colorRampPalette(c("steelblue", "darkblue"))(length(dataset$Accesos))
# Crear el scatterplot con ggplot2
ggplot(dataset, aes(x = Edad, y = Hora, size = Accesos, alpha = Accesos, color = Accesos)) +
geom_point(stroke = NA) +
scale_size_continuous(range = c(2, 10)) +
scale_alpha_continuous(range = c(0.1, 0.8)) +
scale_color_gradientn(colors = color_palette) + # Aplicar la paleta de colores
labs(x = "Edad", y = "Hora", title = colnames(dataset))
And it works perfectly:
But, if instead a field value, I use the Field Parameter
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
49 | |
45 | |
38 | |
37 |