Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
maxduff59
Helper II
Helper II

Request after selecting a value - Script R ?

Hello everybody,

I am quite a newbie on Power Bi and I am facing a setback. Indeed, I have a first R script which allows to have informations on many activities. I would like to request informations on an activity only when it is selected such as the following schema : 

Capture d’écran 2022-10-31 à 14.05.01.png

The informations about the activity could be link thanks to the activity_ID so I decided to create a measure which were containing the id of the activity selected.

However, I do not know now how to do my request. I try to do it with the R from PBI Desktop but it was not working.

Capture d’écran 2022-10-31 à 14.07.09.png

It is probably more efficient to do it in the Power Query but I do not know how to do it because my measure about the selected activity is not there.

 

I would like to know what is the best way to do it. Because I can request my database on R but I do not succeed doing it on PBI.

Thanks in advance for your time

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @maxduff59 ;

Here are three ways to connect R;
1. Importing Data Using R Script.

Open a blank Power Query report in Power BI. Go to Get data under the Home tab and choose More.

Once the pop-up window appears, type R script in the search bar and select it. Then, click Connect.

vyalanwumsft_0-1667290932700.png

2. Executing An R Script In Power Query.
Create a calculated column in the table. You can do this by clicking the Transform tab and then selecting Run R script.

3. Creating Visualizations Using R In Power BI.

vyalanwumsft_3-1667290504136.png

Three Ways To Use R Script In Power BI - Enterprise DNA

You must separately install R on your local computer in order to run R scripts in Power BI Desktop. 
And If you want to filter values, my idea is to import R, create a slicer, and then write the measure in dax.

Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @maxduff59 ;

Here are three ways to connect R;
1. Importing Data Using R Script.

Open a blank Power Query report in Power BI. Go to Get data under the Home tab and choose More.

Once the pop-up window appears, type R script in the search bar and select it. Then, click Connect.

vyalanwumsft_0-1667290932700.png

2. Executing An R Script In Power Query.
Create a calculated column in the table. You can do this by clicking the Transform tab and then selecting Run R script.

3. Creating Visualizations Using R In Power BI.

vyalanwumsft_3-1667290504136.png

Three Ways To Use R Script In Power BI - Enterprise DNA

You must separately install R on your local computer in order to run R scripts in Power BI Desktop. 
And If you want to filter values, my idea is to import R, create a slicer, and then write the measure in dax.

Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors