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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Calling a column parameter in a custom function

Hello,

I have created a custom function in power bi that outputs a data table for an Arima model.  I was able to successfully call a "dataset" parameter, so the user could choose a specific table, but when I tried to do the same with a "column" parameter in my function it did not work. Here is my code,

fnr = [
Arima.model=

(dataset as table,column as list) as table=>

let

  RScript=R.Execute("
  library(forecast)
library(tseries)
Values<-dataset[,4]
ValuesTs<-ts(Values,start=c(1999,1),frequency=4,end=c(2019,4))
fit<-auto.arima(ValuesTs,stepwise=FALSE,approximation=FALSE)                  
df<-data.frame(forecast(fit,h=16))
df['Years']<-seq(2020,2035,1)

",[dataset=dataset]),
output=RScript 
in
   output
    ],

As you can see, I am currently just grabbing the column I need by using the "dataset" parameter but I would like to replace that with my "column" parameter.  I have tried many different ways but I am thinking that I simply have some formatting issues that are making this difficult.  Any help would be greatly appreciated. Thanks.

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

What does the error message say? How about change the parameter with other names like "param1", "param2"?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

The error is: object 'column' can't be found, even though I do select a column for that parameter when I invoke the function

Which is why I figured I had a formatting error when I would try to reference that parameter. This is my code when I tried a different parameter name instead of 'column', unfortunately I got the same error message:

 fnr = [
Arima.model=

(dataset as table,param1 as list) as table=>

let

  RScript=R.Execute("
  library(forecast)
library(tseries)
Values<-param1
ValuesTs<-ts(Values,start=c(1999,1),frequency=4,end=c(2019,4))
fit<-auto.arima(ValuesTs,stepwise=FALSE,approximation=FALSE)                  
df<-data.frame(forecast(fit,h=16))
df['Years']<-seq(2020,2035,1)

",[dataset=dataset]),
output=RScript 
in
   output
    ],

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.