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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
v-yulgu-msft
Employee
Employee

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

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
v-yulgu-msft
Employee
Employee

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.

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

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.

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

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

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

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

Anonymous
Not applicable

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

@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!!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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