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

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.

Reply
rliu
Helper I
Helper I

R visuals in power BI

I am trying to plot a histogram of one of my columns using R. My code works totally fine in R but it won't work in Power BI.

Anybody knows why and how to solve this? Appreciate your help.

6.PNG

So I checked the data type of my "Days.Undecided", it is whole number.

 

1 ACCEPTED SOLUTION

@ankitpatira, in this case all the values are  less than 20 so no separaters.  But what you brought up is a good point! Thank you. I end up just ploting a line/bar chart directly in power BI.

View solution in original post

6 REPLIES 6
BeardyGeorge
Advocate I
Advocate I

if the solutions provided by other users don't work, I would recommend you run this r code on your dataframe and paste the output here:

library(gridExtra)
grid.table(summary(dataset))

 

what it does:

 

Allows you to output a table from an R script to the visualisation window. The results of the "summary" function should show us what's going on.

@BeardyGeorge That's a great tip to know! Thanks.

7.PNG

No problem - it's saved me a fair bit of time trying to figure out the cryptic messages PowerBI gives you.

 

My first guess would be that your PowerBI query is referencing Days.Undecided and your R script there is calling Days_Undecided.

Krunoslav123
Regular Visitor

simple histogram winouth formating  : 

 

#Create dataframe

#dataset <- data.frame(Data1)

 

#Remove duplicated rows

#dataset <- unique(dataset)

 

 

 

hist(dataset$Data1)

ankitpatira
Community Champion
Community Champion

@rliu Do  you have any seperator in your data ie say 1,000 (',' as seperator). You will have to get rid of it and have it as pure numbers to make it work in R. I faced similar issue earier where data type in power bi was number but i had , seperator for thousands and it didn't work in R.

@ankitpatira, in this case all the values are  less than 20 so no separaters.  But what you brought up is a good point! Thank you. I end up just ploting a line/bar chart directly in power BI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.