<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: R-Script Visual Runtime Error in Power BI Server in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1830635#M3677</link>
    <description>&lt;P&gt;Hi, R Visual is currently not supported in Power BI Report Server. it's only available in PBI Service.&lt;/P&gt;&lt;P&gt;checkout the&amp;nbsp; documentation.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/report-server/compare-report-server-service" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/report-server/compare-report-server-service&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2021 17:41:14 GMT</pubDate>
    <dc:creator>winceeS</dc:creator>
    <dc:date>2021-05-07T17:41:14Z</dc:date>
    <item>
      <title>R-Script Visual Runtime Error in Power BI Server</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1816975#M3673</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a R-Script that works/runs perfectly in Power BI Desktop but doesn't work when published to the Power BI Service. I'm not able to pinpoint the error, is it the pipe operator (%&amp;lt;%)? Any help would be highly apperciated, I've been struggling with this issue for some time now.&amp;nbsp; &lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Script Runtime Error: Evaulation Error: Level sets of factors are different&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error_R.PNG" style="width: 538px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/505616i71CD56CC02333CD7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error_R.PNG" alt="Error_R.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R-Script:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# dataset &amp;lt;- data.frame(ProjectName, Commodity, WBS_code, Months, Running_Total_V2, Total_Scope_V2, RTPercentCompleteV2, Project_Description)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# dataset &amp;lt;- unique(dataset)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Paste or type your script code here:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;library&lt;/SPAN&gt;&lt;SPAN&gt;(dplyr)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;library&lt;/SPAN&gt;&lt;SPAN&gt;(ggplot2)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;library&lt;/SPAN&gt;&lt;SPAN&gt;(RColorBrewer)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;proposal_project &amp;lt;- unique(dataset[[&lt;/SPAN&gt;&lt;SPAN&gt;"Project_Description"&lt;/SPAN&gt;&lt;SPAN&gt;]])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# there are duplicates due to WBS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df &amp;lt;- dataset %&amp;gt;% select(ProjectName, Commodity, Months, RTPercentCompleteV2) %&amp;gt;% distinct()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# for projects with multiple entries for the same percent complete, keep the highest value&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df &amp;lt;- df %&amp;gt;% group_by(ProjectName, Commodity, RTPercentCompleteV2) %&amp;gt;% slice(which.max(Months)) %&amp;gt;% arrange(Months)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# group by and interpolate&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pctcomplete &amp;lt;- seq(&lt;/SPAN&gt;&lt;SPAN&gt;0.1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, by=&lt;/SPAN&gt;&lt;SPAN&gt;0.05&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df &amp;lt;- df %&amp;gt;% group_by(ProjectName, Commodity) %&amp;gt;% group_modify(~ {approx(.x$RTPercentCompleteV2, .x$Months, xout=pctcomplete) %&amp;gt;% data.frame()}) %&amp;gt;% ungroup()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;prop_df &amp;lt;- df %&amp;gt;% filter(ProjectName == proposal_project) &lt;/SPAN&gt;&lt;SPAN&gt;# split out proposal data after transformations&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df2df &amp;lt;- df %&amp;gt;% filter(ProjectName != proposal_project)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;data_wo_proposal &amp;lt;- df2df %&amp;gt;% group_by(Commodity,x) %&amp;gt;% summarise_at(vars(y),&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;(mean_duration = mean))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# plot&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mindiff &amp;lt;- min(c(&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;maxdiff &amp;lt;- max(c(max(data_wo_proposal$mean_duration, na.rm=&lt;/SPAN&gt;&lt;SPAN&gt;TRUE&lt;/SPAN&gt;&lt;SPAN&gt;), max(prop_df$y, na.rm=&lt;/SPAN&gt;&lt;SPAN&gt;TRUE&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ticks &amp;lt;- round(seq(mindiff, maxdiff, by=&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;tick_y &amp;lt;- seq(&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;, by=&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;g &amp;lt;- ggplot(data=data_wo_proposal, aes(x=mean_duration, y=x, colour=Commodity)) + geom_line(linetype=&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;) + geom_point()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;final_plot &amp;lt;- g + geom_line(data = prop_df, aes(x=y,y=x,colour=Commodity)) + geom_point(data=prop_df,aes(x=y,y=x,colour=Commodity))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;final_plot_label &amp;lt;- &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;final_plot + labs(title=&lt;/SPAN&gt;&lt;SPAN&gt;'Average Duration of Reference Projects vs Proposal Project'&lt;/SPAN&gt;&lt;SPAN&gt;, subtitle=paste(&lt;/SPAN&gt;&lt;SPAN&gt;'Proposal Project:'&lt;/SPAN&gt;&lt;SPAN&gt;,prop_df$ProjectName[&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;'(solid line in figure below)'&lt;/SPAN&gt;&lt;SPAN&gt;), x= &lt;/SPAN&gt;&lt;SPAN&gt;'Duration (Months)'&lt;/SPAN&gt;&lt;SPAN&gt;,y=&lt;/SPAN&gt;&lt;SPAN&gt;'Percent Complete'&lt;/SPAN&gt;&lt;SPAN&gt;) + theme_bw() + theme(legend.position=&lt;/SPAN&gt;&lt;SPAN&gt;'bottom'&lt;/SPAN&gt;&lt;SPAN&gt;, legend.title=element_blank()) + scale_colour_brewer(palette=&lt;/SPAN&gt;&lt;SPAN&gt;'Set1'&lt;/SPAN&gt;&lt;SPAN&gt;) + scale_x_continuous(breaks=ticks)+scale_y_continuous(labels = scales::percent_format(accuracy = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;),breaks=seq(&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, by=&lt;/SPAN&gt;&lt;SPAN&gt;.05&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;final_plot_label&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Val&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 14:31:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1816975#M3673</guid>
      <dc:creator>Vmartin002</dc:creator>
      <dc:date>2021-04-30T14:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: R-Script Visual Runtime Error in Power BI Server</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1830635#M3677</link>
      <description>&lt;P&gt;Hi, R Visual is currently not supported in Power BI Report Server. it's only available in PBI Service.&lt;/P&gt;&lt;P&gt;checkout the&amp;nbsp; documentation.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/report-server/compare-report-server-service" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/report-server/compare-report-server-service&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 17:41:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1830635#M3677</guid>
      <dc:creator>winceeS</dc:creator>
      <dc:date>2021-05-07T17:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: R-Script Visual Runtime Error in Power BI Server</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1888820#M3730</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to figure out the issue with the R-Script Visual on the Power BI Service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The level of factors was fixed by the following edits:&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Orginal:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;prop_df &amp;lt;- df %&amp;gt;% filter(ProjectName == proposal_project)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df2df &amp;lt;- df %&amp;gt;% filter(ProjectName != proposal_project)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;New:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;prop_df &amp;lt;- df %&amp;gt;% filter(as.character(ProjectName)== as.character(proposal_project))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df2df &amp;lt;- df %&amp;gt;% filter(as.character(ProjectName) != as.character(proposal_project))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also, make sure the package versions are up to date according to&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support&lt;/A&gt;&amp;nbsp;there happened to be unsupported function "group_modify" not supported by the approved dplyr package. Lastly, there seems to be some discrepancies with package versions. To ensure your R-script will run on the power BI service make sure your local machine is running &lt;SPAN&gt;Microsoft R 3.4.4 or R 3.4.4. This is the same R enviroment used on the cloud, so if it runs on your desktop with this version it will run on Power BI service. Also, use install.packages("_____") in your R-Terminal since this will allow package versions that are supported on R 3.4.4. this will help avoid ambiguity.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Best of luck!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Val&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 08 Jun 2021 18:07:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/R-Script-Visual-Runtime-Error-in-Power-BI-Server/m-p/1888820#M3730</guid>
      <dc:creator>Vmartin002</dc:creator>
      <dc:date>2021-06-08T18:07:10Z</dc:date>
    </item>
  </channel>
</rss>

