What’s the story?

Data analysts spend most of their time preparing data before analyzing and reporting insights. This stage is called data cleansing, and is usually composed of two parts.

The first part is ensuring that the data is technically correct. This means that the data is formatted uniformly, for example the data is formatted as decimal numbers, and organized in your preferred structures for analysis.

The second part of data cleansing, and sometimes the more challenging one, is making the data consistent. This means having all the data points in place, correcting outliers, and normalizing to uniform scales. The R language and toolset includes thousands of libraries that can help with data cleansing, so we have added R to our own data cleansing and transformation tool: Power Query. Now that R is supported in Power Query, it also can be used to make general advanced analytics tasks in the data cleansing stage. For example, R can be used to find clusters in the dataset.

How does this work?

In the Power BI Desktop, go to the query editor by selecting Edit Queries.

In the query editor, select the Transform tab.

In the right side of the Transform tab, select the new Run R Script button.

By clicking the R button, you can add your own R script as another Power Query step.