Open Side Menu
Skip to contentBrand Logo
Forums
Inspiration
Ideas
Communities
Blogs
Learning
Support
RegisterSign In
  1. Microsoft Fabric Community
  2. Power BI forums
  3. Galleries
  4. R Script Showcase
Sharon's avatar
Sharon
Microsoft Employee
10 years ago

Forecasting

Description Forecasting is used to predict next points in time series data sets. The prediction in this example is based on trend and seasonality.     Prerequisites (The sample .pbix file...
Forecasting Showcase.pbix635 KB
ScriptInstallPackagesWithWorkaroundsForecast.R1 KB
Advanced Analytics Visualizations
Anonymous's avatar
Anonymous
Not applicable
9 years ago

Hi there!

First of all, awesome visual! It took me a week to script the ets forecasting in R on my data, and I've been able to get what I want, but then the problem is that it generates a completely new set of data, unrealted to the existing model in Power BI. Your visual solves this problem by integrating the R script (very similar to what I have) into Power BI, so now I can use measures. Great work.

 

Afew things missing here: the Y-axis is poorly marked, if we're talking about millions of dollars on the Y axis. Also, no labels. So, I decided to clone this visual and create my small variation. Standing on the shoulders of giants, as they say

 

All I've done so far is adjusted the R script to also populate a table of values along with the graph. I left the rest untouched.

I got to the point that suits me for now (I hope to keep improving) and I can see needed results on the web when I run pbiviz start command.

But when I try to package the visual, the packaged custom visual for PBI Desktop doesn't have any of those changes... What am I doing wrong?

boefraty's avatar
boefraty
Microsoft Employee
9 years ago

You didn't call "pbiviz new" command, instead you are updating the existing one. So you'll need to do two things:

1) change "guid" field inside "pbiviz.json" to be different string

2) call "pbiviz package" command from command line ( inside the folder of visual)

 

See more here

https://github.com/Microsoft/PowerBI-visuals/tree/master/RVisualTutorial

 

 

  • thefal's avatar
    thefal
    Frequent Visitor
    9 years ago

    Hi,

     

    I am fairly new to Power BI and don't know a lot about R scripting yet. I downloaded the file, but it gives me an error in the left visual: there is no package called 'scales'. I also downloaded the R script that I assume installs these packages. But how do I run the script to create them?

     

    I am using C:\Program Files\Microsoft\MRO-3.3.2 as my home directory and Visual Studio 2015 as my R IDE.

    • boefraty's avatar
      boefraty
      Microsoft Employee
      9 years ago

      I sent a reply to private mail. Hopefully it helps...  

       

      In general to install missing package you need to type install.packages("scales")   from any R command line (R studio or VS IDE). Alernatively, you run the script.

      See

      https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-r-powered-custom-visuals/

       

      Scroll down till you see:

      "Install R packages manually, using any R console"

       

    • ironryan77's avatar
      ironryan77
      Kudo Commander
      9 years ago

      I ran into this same problem initially.  What you have to do to fix:

      Update R for Windows from the R Script command line:

      if(!require(installr)) {
      install.packages("installr"); require(installr))

      It will tell you you're using 3.3.2, but the latest version is 3.3.3.  To update, run this command:

       

      updateR()

      Then open MRO 3.3.3 and load the scales package:

       

      This should install the zoo and forecast package for you, but if it doesn't manually install these packages from the screenshot above.

  • © 2026 Microsoft
  • Manage cookies
  • Privacy & cookies
  • Terms of use
  • Trademarks
Your Privacy Choices Consumer Health Privacy