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
pdfins
New Member

Using Rblpapi

Has anyone been able to use the Rblpapi package in Power BI? I have a Dates table and use a slicer to narrow it to a range. I'm trying to use that range to get a list of historical prices for a security I pass in.

 

Example:

library(Rblpapi)

bdh(securities = 'GOOG US Equity',
fields = "PX_LAST",
start.date = as.Date(DATE),
include.non.trading.days = FALSE)

 

This gives me:
Error in as.Date(DATE) : object 'DATE' not found
Calls: bdh -> as.Date
Execution halted

 

Any thoughts?

 

 

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I'm not that familiar with the package Rblpapi package, but I assume that you have to utilize the dataframe that contains the columns from the values bucket, that is passed from Power BI to the R script.

 

For this reason I would expect that this line

as.Date(DATE)

should look like this

as.Date(dataset$nameofyourdatecolumn)

 Please be aware that R is case sensitive 🙂

 

A short investigation of the bdh function also expects a connection parameter, I guess you have to provide this connection inside your script.

 

I hope this helps somehow



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

I'm not that familiar with the package Rblpapi package, but I assume that you have to utilize the dataframe that contains the columns from the values bucket, that is passed from Power BI to the R script.

 

For this reason I would expect that this line

as.Date(DATE)

should look like this

as.Date(dataset$nameofyourdatecolumn)

 Please be aware that R is case sensitive 🙂

 

A short investigation of the bdh function also expects a connection parameter, I guess you have to provide this connection inside your script.

 

I hope this helps somehow



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

It was the dataframe, much apprec!

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.