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
davidsimm10
Frequent Visitor

R visualisation to use imported tables

I am trying to use the 'R' visualisation in PowerBI. I have installed RStudio, linked PowerBI to R etc.

 

I am hoping that I can use the fields from a 'Get Data' import. I have pulled in data from a SQL database, used the 'R' visualisation and tried to code the following...

 

dataset <- data.frame(CountSpellID, WardLocalDescription)
dataset <- unique(dataset)
View(dataset)
 
It returns the error.
 
Error in data.frame(CountSpellID, WardLocalDescription) ;
object 'CountSpellID' not found
Execution halted
 
Can someone please tell me where I am going wrong?
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You are supposed to drag existing fields from your Power BI data model into the values area of the R visual, so that they can be added to the dataframe.  Don't modify that part of the script or manually specify any fields.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

You are supposed to drag existing fields from your Power BI data model into the values area of the R visual, so that they can be added to the dataframe.  Don't modify that part of the script or manually specify any fields.

This worked thank you! I didnt quite understand what you meant. I presumed because of the hashtags that it wouldnt work properly. Huge thank you

 

# 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(CountOfPatients, Division)
# dataset <- unique(dataset)

# Paste or type your script code here:

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.