1

I've a PowerBI report with a SQL Server datasource thats retrieves data from a database database_{number}.

{number} is a query params of PowerBI. I can change it from Data Transform -> Edit parameters and it works correctly.

It's possibile to edit this parameter of a web published report? for example changing an URL query params?

Luke_0
  • 779
  • 5
  • 20

1 Answers1

0

100% this can be done. First, create a connection to any one of the databases normally. Go to advanced editor, and you will see something like this:

let
    Source = Sql.Database("1.1.1.1\address", "database_001")
in
    Source

Simply modify this to reference the parameter:

let
    Source = Sql.Database("1.1.1.1\address", "database_" & number) 
in
    Source

You may want to consider changing the parameter name because number is a predefined data type, that could be ambiguous in some cases.

One note, depending on your server capabilities, changing the reference to be dynamically generated may prevent query-folding. Query-folding is the ability for a single query to be executed against the SQL server based on your PowerQuery script. Without query-folding, a larger query will likely be executed against the server, and your data model will take longer/more resources to refresh. https://learn.microsoft.com/en-us/power-query/power-query-folding

Luke_0
  • 779
  • 5
  • 20
  • I know that it's possibile to change database runtime with parameters. I want to know if it's possibile to change parameter by url query param of web published report – Matteo Cappello May 29 '23 at 06:46
  • Ah, I see. Yes, you can do this, but only in paginated reports. https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/pass-report-parameter-url – Luke_0 May 29 '23 at 13:54
  • You can pass report parameters to regular reports, but not query parameters. The only workaround would be to load every DB possible to the report, and then use a report URL parameter to filter to the DB you want. – Luke_0 May 29 '23 at 14:05