Member-only story
R.Execute() the Swiss Army knife of Power Query
I rarely use in Power BI, but when I do, I make sure to keep the data mashup out of it. I don’t have anything against R, it’s arguably the best statistical tool out there, however when it comes to using an expressive language for doing data wrangling, Power Query (M) is my language of choice.
Although R has been introduced to Power BI ecosystem as a complimentary tool, its capabilities exceed by far those of the Microsoft’s analytics suite. That is why in areas where Power BI is falling behind, I can always rely on R to bridge the gap.
Below I describe 5 patterns of how I use R.Execute() in Power Query. I have divided these in 2 classes — as intended and unintended use cases — just to separate the expectation for how much support these patterns will be getting from Power BI team.
Note: When using R.Execute() the only rule I follow is that if I need some data out of an R routine, I must put the execution results into a dataframe. Other than that all R rules apply.
Executing an algorithm
This is probably one of the most legit use-cases for using R in Power BI. Because there is no language/framework/library that can compare to the vast variety of algorithms implemented in R. If you need to run some exotic algorithm on your data, most likely there is…