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

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
Microsoft
Microsoft

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.

View solution in original post

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

View solution in original post

9 REPLIES 9
Microsoft
Microsoft

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.

View solution in original post

harshadsp Post Patron
Post Patron

Re: Slicer Value as a parameter to stored procedure

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

Microsoft
Microsoft

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 Post Patron
Post Patron

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 🙂 I hope this will be added in near future.

 

I appreaciate your help in this matter!

 

Thanks

Harshad

scorreia
Regular 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 Post Patron
Post Patron

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

View solution in original post

harshadsp Post Patron
Post Patron

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 🙂 he he he. I am subsribing you course on udemy. Really great video. Your time & efforts are highly appreciated!!!

shreepadbidwai
Frequent Visitor

Re: Slicer Value as a parameter to stored procedure

Not able to execute stored procedure using your solution... Can you please help me with this

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors