Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi
i want to achieve predictive analytics in power bi using r, below are the code.
but i am not getting
counts <-table(dataset$May2017,dataset$name)
pred <-predict(dataset$May2017)
pred1 <-data.frame(pred)
final <-cbind(counts,pred1)
barplot(final)
Hi @kalpanaV,
What's your issue? Did you get an error message? If you want to create a R visual in Power BI desktop, you should follow the following steps.
1. Install R in your local computer.
2. Enabling visuals by selecting File-> Options and settings-> Options ->R Scripting, type the R installation path.
3. Type your resource data in a table, create a visual, add the 'May2017' and 'name' fields to values level. Then it will create the dataset(highlighted in yellow backgroud) automatically. Finally type your R script in the write zone highlighted in blue line.
Best Regards,
Angelia
i did that. i want to achieve predictive analytics.i can do normal bar chart , line chart
Hi @kalpanaV,
You did it in R visual, if it worked fine? If it works fine in R visual, it should have no problem of creating R visual.
Best Regards,
Angelia
its not working ..
i told that , barplot and line chart is working but i dnt need that.
i want to do predictive analytics
what do you mean by predictive analytics in this context? Do you have some R scripts that you're looking to run and output the data of, or create some visuals off the back of that?
Without some more explicit information it's unlikely anyone on this board will be able to help you.
George.
created time is when the tickets are created. and count id is a measure of tickets(count of tickets) below is the code i have exceuted
library(forecast)
data2<-data.frame(dataset)
# group searches by date
dataset <- aggregate(Count_Id ~ Created_Time, data = data2, FUN= sum)
summary(dataset)
# create a time series based on day of week
ts <- ts(data2$Count_Id, frequency=4)
# pull out the seasonal, trend, and irregular components from the time series (train the forecast model)
decom <- stl(ts, s.window = "periodic")
# predict the next 7 days of searches
pred <- forecast(decom, h = 3)
# plot the predicted searches
plot(pred)
and finally i got the graph, but i am not understanding what the graph is exactly saying
is there any possibility to getany graph model instead of this model.
can you please explain me what graph is saying
Hi @kalpanaV,
For forecast package in R, it uses ARIMA model to estimate the futher, so it need to time series. You can also use other model like linear fitting to estimate the further data, which needs to create the function by yourself.
Best Regards,
Angelia
can you please tell me wat function i need to create?
I have the data for july month1 to 31 (data is about tickets).
i want to predict the no of tickets for next month.
below are the code which i executed.
i cretaed a measure called count_id. created_time is the field(date)
library(forecast)
data2<-data.frame(dataset)
# group searches by date
dataset <- aggregate(Count_Id ~Created_Time , data = data2, FUN= sum)
summary(dataset)
# create a time series based on day of week
ts <- ts(data2$Count_Id, frequency=4)
# pull out the seasonal, trend, and irregular components from the time series (train the forecast model)
decom <- stl(ts, s.window = "periodic")
# predict the next 7 days of searches
pred <- forecast(decom, h = 3)
# plot the predicted searches
plot(pred)
the thing is
in may month, 21 High priority tickets came
in june month, 50 high priority tickets came.
in july month, 45 high priority tickets came.
i want to predict in august month that how much tickets will come approximately.
can you please tell me, is this possible or not.
Hi @kalpanaV,
Please create a table in POwer BI, like the following sample table. Create a R visual, select the Date, tickets as value, then type the R script.
library(forecast) # group searches by date dataset <- aggregate(tickets ~ Date, data = dataset, FUN= sum) # create a time series based on day of week ts <- ts(dataset$tickets, frequency=7) # pull out the seasonal, trend, and irregular components from the time series (train the forecast model) decom <- stl(ts, s.window = "periodic") # predict the next 7 days of searches pred <- forecast(decom, h = 7) # plot the predicted searches plot(pred)
More details, please review this article: Dynamic Forecasting With Power BI And R.
Best Regards,
Angelia
decom <- stl(ts, s.window = "periodic") when i excute this, i am getting below error.please help me on this.
> library(ggplot2)
> data2<-data.frame(dataset)
> dataset <- aggregate(tickets ~ month, data = data2, FUN= sum)
> ts <- ts(data2$tickets, frequency=30)
> decom <- stl(ts, s.window = "periodic")
Error in stl(ts, s.window = "periodic") :
series is not periodic or has less than two periods
Update the frequency to 3 because you are trying to analyse for only 3 months .
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.