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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors