<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/using-rsitecatalyst-with-microsoft-powerbi-desktop/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://randyzwitch.com/rsitecatalyst-powerbi-desktop-microsoft/"> randyzwitch.com</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>With pretty regular frequency I get emails asking if RSiteCatalyst can be used with <a rel="nofollow" href="https://powerbi.microsoft.com/en-us/" target="_blank">Microsoft Power BI</a>. While admittedly I’m not a frequent user of the Windows operating system (nor dashboarding tools like Tableau or Power BI), I am pleased to report that it is fact possible to call the <a rel="nofollow" href="https://marketing.adobe.com/developer/documentation/analytics-reporting-1-4/whatsnew" target="_blank">Adobe Analytics API</a> with Power BI via RSiteCatalyst!</p>
<h2>Step 1: Call Adobe Analytics API Using <code>Get Data</code> Menu</h2>
<p>The majority of getting RSiteCatalyst to work within Power BI desktop is getting the R script correct. From the <code>Get Data</code> menu, choose the <code>More...</code> menu option to bring up all of the data import tools that Power BI defines:</p>
<p><img alt="rsitecatalyst powerbi get data" src="https://i0.wp.com/randyzwitch.com/assets/img/rsitecatalyst-powerbi-getdata.png?w=456" data-recalc-dims="1"></p>
<p>Once you choose ‘R Script’, an input box will open where you can place your RSiteCatalyst function calls:</p>
<p><img alt="rsitecatalyst powerbi rscript" src="https://i2.wp.com/randyzwitch.com/assets/img/rsitecatalyst-powerbi-rscript.png?w=456" data-recalc-dims="1"></p>
<p>After hitting ‘OK’, Power BI will evaluate your R code, determining which statements return a <code>data.frame</code> (which is the only allowable data structure imported into Power BI). You can choose which <code>data.frame(s)</code> you want to import from the ‘Navigator’ window:</p>
<p><img alt="rsitecatalyst powerbi navigator" src="https://i1.wp.com/randyzwitch.com/assets/img/rsitecatalyst-powerbi-navigator.png?w=456" data-recalc-dims="1"></p>
<p>Once you hit ‘OK’, Power BI imports the data and you can use your Adobe Analytics data just as you would in R with RSiteCatalyst (or, like any other data source like CSV or database…)</p>
<h2>Limitations</h2>
<p>While it’s possible to call RSiteCatalyst through Power BI, there are some limitations to keep in mind.</p>
<p>First, RSiteCatalyst will only work with Microsoft Power BI <em>Desktop</em>, which is installed locally on your machine. The Power BI Service, which is more of a shared dashboard/data store environment, <a rel="nofollow" href="https://docs.microsoft.com/en-us/power-bi/service-r-packages-support#requirements-and-limitations-of-r-packages" target="_blank">does not allow external API calls</a> as part of its security model. So while you can analyze your data locally, you cannot share dashboards to the Power BI Service.</p>
<p>The second limitation I’ve noticed is that Power BI doesn’t read from from a <code>.Renviron</code> file (at least, not from the default Windows location that R GUI reads). So you will need to place your credentials directly in the R script, which is never really ideal (though, may not be a big deal all things considered).</p>
<p>Finally, the R script runs synchronously, so when placing multiple calls in the same R script you will need to wait for all of the <code>data.frame</code> results before you can use them within Power BI. This is the same default behavior within R, sans using <a rel="nofollow" href="https://rstudio.github.io/promises/" target="_blank">Promises</a> or parallelism of some sort, but it’s still important to keep in mind.</p>
<h2>Dashboards, Dashboards, Dashboards!</h2>
<p>With a few minutes work, I was able to create this rudimentary dashboard (<a rel="nofollow" href="http://randyzwitch.com/assets/r_code/rsitecatalyst_powerbi_example.R" target="_blank">R code</a>):</p>
<p><img alt="rsitecatalyst powerbi dashboard" src="https://i1.wp.com/randyzwitch.com/assets/img/rsitecatalyst-powerbi-dashboard.png?w=456" data-recalc-dims="1"></p>
<p>Someone with more interesting/higher volume data could surely do better. But the most important thing in my opinion is that Microsoft has built an awesome integration with R and that creating dashboards in Power BI is <em>waaaaaay</em> easier than the last time I tried to create a dashboard using Excel and the Adobe Report Builder plugin.</p>
<p>Happy dashboarding!</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://randyzwitch.com/rsitecatalyst-powerbi-desktop-microsoft/"> randyzwitch.com</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/cwdy2h3sd-4" height="1"></a></div>