Skip to main content

Power BI

New

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

56198f11 658b-44a8-9d2a-0472f7da3c28 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

d81245eb 34cc-4cf8-b15f-79b34a0aa22a 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

9533595f 3c7a-4dcb-ac3c-59f861de854b 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

5d74cdd8 28f1-412a-b39d-594b27e643fc 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

6c6fe094 7813-4b73-b32e-6bf62e55fcbf 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.