Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Pass parameter to SQL Stored Procedure query from Slicer

Hi all,

As the title, we are now facing a problem with the data source. We have a stored procedure which required a parameter is YEAR, because we need to filter the data by Year before showing on the report/chart. 

We found that Power BI has Parameters management already but I'm not sure this can work with Slicer?

We really need help to select a year from Slicer and then reload all the data from the database.

 

Thanks in advance.

7 Replies

  • Hi Anonymous,

     

    the way you imagine it will not work, because the slicer is 'active' after PowerQuery is executed and "you can't get back".

     

    What you can do is when the user opens the report he has to enter a year parameter.

     

    To do this, I'd like to refer you to this article. This is about entering a username and receiving the data but the principle is basically the same.

     

    I don't see any more elegant way to accomplish this.

     

    If this post was helpful may I ask you to mark it as solution and give it some kudos?

    Have a nice day!

    BR,
    Josef

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much JosefPrakljacic,

      It's really helped me out when I need to change the data from DataSource.

      But it just requests the Parameter when Open the PowerBI Template file with Power BI Desktop, can we apply it with the Power BI Web? 

      Hope to hear from you soon.