This tutorial describes how t use R to modify queries in Power BI. Click here to see how to use R for visuals or here to see how to use R for data source definition.

To make the following approach available, R has to be installed.

So how to use R directly in query?

First, we need some query. When ready, we can create a step (probably something that can be done easier in R then in Power BI environment.

As Power BI suggest, the table created from previous query steps can be found in “dataset” data.frame.

new_dataset = dataset[,-5]

This command simply removes the fifth column. Yes, this is too simple and you don´t need R to make this step, since columns can be normally deleted in query.

With this command new step (or two steps, actually…) are added. And any normal query step can follow.