cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
harshadsp Member
Member

Slicer Value as a parameter to stored procedure

Hello, Need help to know if its possible or is there any work around.

 

I have a slicer which contains around 50 values for City Name. I have sourced the stored proecudre for the dashboard. is it possible if a one selected slicer value wuld be passed to stored procedure? I serached a log on many forums but there is no way to do this but is there any work around or trick to do so.

 

Please advise, thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Slicer Value as a parameter to stored procedure

Hi @harshadsp,

 

It is not possible to pass a selected value from slicer to stored procedure.

 

If you want to pass values to stored procedure parameters, you can consider using Power Query parameter. Here are some links for your reference:

Power Query and Stored Procedures with parameters

parameters to SP or Sql query

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Re: Slicer Value as a parameter to stored procedure

It turns out that this is actually possible in Power BI. I've created a walkthrough video on how to do this here.

 

The basic gist is to add an R visual that takes in your slicer selection as its value. There is an R package called RODBC that can run SQL code against your database. You can then pass your slicer value into the SQl query using some string interpolation or the "paste" function. Let me know how this works for you.

 

Thanks,

Parker

8 REPLIES 8
Community Support Team
Community Support Team

Re: Slicer Value as a parameter to stored procedure

Hi @harshadsp,

 

It is not possible to pass a selected value from slicer to stored procedure.

 

If you want to pass values to stored procedure parameters, you can consider using Power Query parameter. Here are some links for your reference:

Power Query and Stored Procedures with parameters

parameters to SP or Sql query

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
harshadsp Member
Member

Re: Slicer Value as a parameter to stored procedure

@v-yulgu-msft thanks for the links! I will go through those.

Community Support Team
Community Support Team

Re: Slicer Value as a parameter to stored procedure

Hi @harshadsp,

 

If above links are helpful to your scenario, appreciate that you could mark it as an answer so that others having similar requirement can find the solution more easily. If you still have any question, please feel free to ask.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
harshadsp Member
Member

Re: Slicer Value as a parameter to stored procedure

Hi @v-yulgu-msft,

 

Sorry for delayed response. Yes, the above links are really helpful and it did workaround upto certain extent but it would be help full if power bi could pass parameter directly from visuals to stored procedures Smiley Happy I hope this will be added in near future.

 

I appreaciate your help in this matter!

 

Thanks

Harshad

Highlighted
scorreia Frequent Visitor
Frequent Visitor

Re: Slicer Value as a parameter to stored procedure

Hello All,

I am new to Power BI and have just joined the community.

I had a requirement of passing the slicer values to a stored procedure and came across this blog. Is this feature now available and if yes in which version?

Has anybody tried passing values from slicer to a stored proceudre?

I need to pass 2 date values to my stored proc from the date slicer.

 

Thanks for your help.

 

Regards

Sophia

harshadsp Member
Member

Re: Slicer Value as a parameter to stored procedure

Hi @scorreia,

 

As per my knowledge its still not possible yet but you may get some help from following link

 

https://community.powerbi.com/t5/Integrations-with-Files-and/parameters-to-SP-or-Sql-query/m-p/58337

 

Thanks

Harshad

 

Anonymous
Not applicable

Re: Slicer Value as a parameter to stored procedure

It turns out that this is actually possible in Power BI. I've created a walkthrough video on how to do this here.

 

The basic gist is to add an R visual that takes in your slicer selection as its value. There is an R package called RODBC that can run SQL code against your database. You can then pass your slicer value into the SQl query using some string interpolation or the "paste" function. Let me know how this works for you.

 

Thanks,

Parker

harshadsp Member
Member

Re: Slicer Value as a parameter to stored procedure

@AnonymousThis is really awesome! You have saved my lot of work and probably my job as well Smiley Happy he he he. I am subsribing you course on udemy. Really great video. Your time & efforts are highly appreciated!!!