Search code examples
powerbirscriptpowerbi-datasource

How to read values from PBI Slicer and use in Rscript(Data source) of PowerBI?


Is it possible to read selected value of PBI Slicer from PowerBI and use it in R script(Datasource) to retrieve the results, which generates new datasource.

The thing is column filter works great on data frame generated with R script but what I need is to do calculation based on the selected value of specific column rather then just filtering data.

To simplify , I will put it this way, is it possible to create dynamic Rscript rather than static ones in PowerBI?


Solution

  • If you want to Read value of PBI Slicer/ Filter and recalculate the Data and Generate Graph accordingly, R Script Visual is the answer.

    • Create R script using loaded columns and filters,
    • Make sure this generates visual, else ERROR.
    • During calculation Generated DF are not loaded in Datasource But can be used to Refresh the Graph.
    • The visual, reads data from filter, runs script generates DF and hence Dynamic graphs.

    enter image description here