I recently came across an interesting article on MSSQLTips for SQL Server Reporting Services that showed how you could use a T-SQL query as the parameter value, and have it return a table of data as the result set from that query. (The original article is here, and I will fully admit that all I did was take this author’s idea (and that of one of the commenters) and stick it into this sample report – https://www.mssqltips.com/sqlservertip/5757/create-dynamic-ssrs-reports-using-a-query-as-an-input-parameter/ ). I wanted to see if this worked for Paginated Reports in Power BI, and of course it does! So once I put in my connection string information for my Azure SQL database (the original article was against a traditional SQL Server database), I can write just about any select query against that database as a parameter at runtime and get back results in a nice table that can be exported out to Microsoft Excel. I created a short video to show you how it works in practice –
Now there’s little chance I’d use this report as is in production – it’s really just a way for me to test some things, dump out data quickly, and it demos nicely. But there are some ways you could potentially change this to make it more production friendly – have a list of dropdown values that represent the queries that you update on an ongoing basis, or even allow users to submit queries through a workflow you approve that updates the parameter list.
If you’d like to try it out yourself, feel free to download the sample report –
Once downloaded, you’ll need to update the data source with your connection string to whatever database you’ll use this against in Power BI Report Builder before you can use it in the service, but once you do that, you should be good to go.
Thanks for reading!
Reblogged this on MS Excel | Power Pivot | DAX | SSIS |SQL.
LikeLike
Link to original report throwing up a 404 Error!
Trying to understand how this works. New to Paginated Reports … AND SSRS.
I’m going to like Paginated Reports!!
LikeLike
I fixed the link, and glad you’re going to love paginated reports!
LikeLike