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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.