Skip to main content
Microsoft Idea

Power BI

Needs Votes

Use R script in a measure

Vote (50) Share
Alan Sagan's profile image

Alan Sagan on 12 Oct 2016 08:52:58

Sometimes we need measures that are far more mathematically complicated than PowerBI is capable of -- for example, computing the 75th percentile of the product of two normal distributions.

This is something we can compute from a dataset in R, but don't neccessarily want this computed on load using PowerQuery/R Scripts, or just in a visual with R visuals.

Could we get the ability to write our own R scripts/functions which return a singular value and use them in a measure? Or have the measure itself just be an R script?

Comments (5)
Alan Sagan's profile image Profile Picture

ChrisU on 05 Jul 2020 23:42:00

RE: Use R script in a measure

Would be fantastic to be able to get p-values (and other statistics) for various statistical tests as measures. Would make it easy to dynamically calculate and display statistical tests across many factors.

Alan Sagan's profile image Profile Picture

Katja on 05 Jul 2020 23:36:47

RE: Use R script in a measure

Tableau kann es....Power BI wann?

Alan Sagan's profile image Profile Picture

elfersi on 05 Jul 2020 23:23:01

RE: Use R script in a measure

i found a dirty fix for this. use r to display the result of the measure as a wordcloud. pbi will do it

Alan Sagan's profile image Profile Picture

Chad Koziel on 05 Jul 2020 23:20:39

RE: Use R script in a measure

Presumably the challenge with implementation is related to R being far more flexible in terms of the type of entity it can return than DAX is, but this feature would really help bring advanced analytics into the Power BI environment.

Current options are either a) use R in Query Editor (analytics are then not dynamic) or b) use R custom visuals (visual consistency with standard Power BI objects is difficult / impossible to achieve). Neither is a good option.

Alan Sagan's profile image Profile Picture

BHARATH SANKARANARAYANAN on 05 Jul 2020 23:20:28

RE: Use R script in a measure

This feature would make a lot of sense. I am currently aggregating data from my database and having this feature would reduce the rows in my dataset from 6 million to somewhere around 4 million.