Forum Discussion

luxpbi's avatar
luxpbi
Helper V
8 years ago

R script visual not working in Service

Hi, 

 

I've created a R visual that load data from RData Files. Everything is working fine in desktop. 

 

But I have problem when I upload it to the cloud, the script doesn't found the path of the files because they are in local ... obiously. 

How can I solve this?

 

Thanks in advance!

7 Replies

    • luxpbi's avatar
      luxpbi
      Helper V

      Hi Stachu,

       

      The problem is just with the visual. 

      I attach photos in case it helps to see the problem.

      • TomMartens's avatar
        TomMartens
        Super User

        Hey,

         

        as far as I understand your R script that works perfectly in your Power BI Desktop contains basically these 3 steps:

        • read source data
        • prepare the data
        • create the visual

        these 3 steps in one single r script will wonk in PBI Desktop.

         

        But this will not work in the service, the reason is:
        R script visuals or Custom Visuals (R based) are running in a kind of sandbox and are not allowed to access "external" ressources.

         

        For this reason you have to split your R scipt.

        • reading the source data (this can be done by using the R script source connection)
          this step has to return a table object to the Power BI data model
          be aware that it is necessary to install the on-premises data gateway in personal mode
        • create the r visualbased on the Power BI table

        The data preparation (if necessary) can either be done in the first step or also in the r script that creates the visual

         

        This link will maybe also useful:

        https://docs.microsoft.com/en-us/power-bi/desktop-r-in-query-editor

         

        Regards,

        Tom